add arch linux support to newbox
This commit is contained in:
parent
2879815374
commit
de3b2caa3a
1 changed files with 21 additions and 8 deletions
29
newbox
29
newbox
|
|
@ -7,27 +7,40 @@ fail() {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function command_exists() {
|
||||||
|
which "$1" >/dev/null 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
install() {
|
install() {
|
||||||
|
|
||||||
|
if command_exists "$1"; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# apt (debian / ubuntu)
|
# apt (debian / ubuntu)
|
||||||
if which aptitude >/dev/null 2>&1; then
|
if command_exists aptitude; then
|
||||||
sudo aptitude install -y "$@"
|
sudo aptitude install -y "$1"
|
||||||
|
|
||||||
# homebrew (os x)
|
# homebrew (os x)
|
||||||
elif which brew >/dev/null 2>&1; then
|
elif command_exists brew; then
|
||||||
brew install "$@"
|
brew install "$1"
|
||||||
|
|
||||||
# rpm (redhat / centos / fedora)
|
# rpm (redhat / centos / fedora)
|
||||||
elif which yum >/dev/null 2>&1; then
|
elif command_exists yum; then
|
||||||
sudo yum install -y "$@"
|
sudo yum install -y "$1"
|
||||||
|
|
||||||
|
# arch
|
||||||
|
elif command_exists pacman; then
|
||||||
|
sudo pacman -S "$1"
|
||||||
|
|
||||||
else
|
else
|
||||||
fail "Don't know how to install $@ on this box. Install $@ and run this again."
|
fail "Don't know how to install $1 on this box. Install $1 and run this again."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install zsh git || fail "Failed to install zsh & git."
|
install zsh || fail "Failed to install zsh."
|
||||||
|
install git || fail "Failed to install git."
|
||||||
|
|
||||||
cd ~
|
cd ~
|
||||||
if ! [[ -d config ]]; then
|
if ! [[ -d config ]]; then
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue