mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 04:46:41 +00:00
Add script to install zsh from source
This commit is contained in:
45
scripts/install-zsh.sh
Executable file
45
scripts/install-zsh.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PREFIX="/opt/zsh"
|
||||
|
||||
help() {
|
||||
echo "usage: ./install-zsh.sh <VERSION>"
|
||||
}
|
||||
|
||||
install() {
|
||||
local version="$1"
|
||||
mkdir -p /tmp/zsh-src
|
||||
cd /tmp/zsh-src
|
||||
if [ ! -d "zsh-${version}" ]; then
|
||||
if [ ! -f "zsh-${version}.tar.gz" ]; then
|
||||
wget "http://downloads.sourceforge.net/project/zsh/zsh/${version}/zsh-${version}.tar.gz"
|
||||
fi
|
||||
tar -zxf "zsh-${version}.tar.gz"
|
||||
fi
|
||||
cd "zsh-${version}"
|
||||
./configure --prefix="$PREFIX" && make && sudo make install
|
||||
}
|
||||
|
||||
deps() {
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential
|
||||
}
|
||||
|
||||
main() {
|
||||
local command="$1"
|
||||
|
||||
if [ -z "$command" ]; then
|
||||
echo "$(help)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$command" == "deps" ]; then
|
||||
deps
|
||||
else
|
||||
install "$command"
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
||||
Reference in New Issue
Block a user