update newbox script to work on rpm systems

This commit is contained in:
Sami Samhuri 2013-08-21 13:14:57 -07:00
parent 3983d45696
commit 2e636bc4f6

50
newbox
View file

@ -1,33 +1,35 @@
#!/usr/bin/env bash #!/usr/bin/env bash
fail() { fail() {
echo "error: $@" echo "error: $@"
exit 1 exit 1
} }
if ! which zsh >/dev/null 2>&1; then install() {
if which aptitude >/dev/null 2>&1; then
sudo aptitude install -y zsh
elif which brew >/dev/null 2>&1; then
brew install zsh
else
fail "Don't know how to install zsh on this box. Install zsh and run this again."
fi
fi
if ! which git >/dev/null 2>&1; then # apt (debian / ubuntu)
if which aptitude >/dev/null 2>&1; then if which aptitude >/dev/null 2>&1; then
sudo aptitude install -y git-core sudo aptitude install -y "$@"
elif which brew >/dev/null 2>&1; then
brew install git-core # homebrew (os x)
else elif which brew >/dev/null 2>&1; then
fail "Don't know how to install git on this box. Install git and run this again." brew install "$@"
fi
fi # rpm (redhat / centos / fedora)
elif which yum >/dev/null 2>&1; then
sudo yum install -y "$@"
else
fail "Don't know how to install $@ on this box. Install $@ and run this again."
fi
}
install zsh git
cd ~ cd ~
if ! [ -d config ]; then if ! [[ -d config ]]; then
git clone git://github.com/samsonjs/config || fail "cannot clone config repo" git clone git://github.com/samsonjs/config || fail "cannot clone config repo"
fi fi
cd config cd config
@ -38,7 +40,7 @@ echo " * Done!"
# FIXME figure out how to change the shell semi-interactively (only type in password) # FIXME figure out how to change the shell semi-interactively (only type in password)
if ! grep `id -u` /etc/passwd | grep zsh; then if ! grep `id -u` /etc/passwd | grep zsh; then
#chsh -s `which zsh` #chsh -s `which zsh`
echo " *** Use chsh to change your shell to `which zsh`" echo " *** Use chsh to change your shell to `which zsh`"
fi fi