refactor installation
This commit is contained in:
parent
f689319e98
commit
7d0b067bdb
31
install.sh
31
install.sh
@ -1,28 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
exists () {
|
exists () {
|
||||||
which $1 &> /dev/null; echo $?
|
which $1 &> /dev/null; echo $?
|
||||||
}
|
}
|
||||||
|
|
||||||
declare -a tools=("zsh" "git" "rake")
|
install () {
|
||||||
|
pkg=$1
|
||||||
for tool in "${tools[@]}"; do
|
cmd=$2
|
||||||
if [ `exists $tool` != "0" ]; then
|
if [ -z "$2" ]; then
|
||||||
|
cmd=$pkg
|
||||||
|
fi
|
||||||
|
if [ `exists $cmd` != "0" ]; then
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
brew install $tool
|
brew install $pkg
|
||||||
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
|
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
|
||||||
apt $tool -y
|
sudo apt install $pkg -y
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
install fontconfig fc-cache
|
||||||
|
tools=("zsh" "git" "rake")
|
||||||
|
for tool in "${tools[@]}"; do
|
||||||
|
install $tool
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ `exists fc-cache` != "0" ]; then
|
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
|
||||||
brew install fontconfig
|
|
||||||
elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then
|
|
||||||
apt fc-cache -y
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$HOME/.yadr" ]; then
|
if [ ! -d "$HOME/.yadr" ]; then
|
||||||
echo "Installing YADR for the first time"
|
echo "Installing YADR for the first time"
|
||||||
|
Loading…
Reference in New Issue
Block a user