bin/newbox

48 lines
924 B
Bash
Executable file

#!/usr/bin/env bash
set -e # bail on errors
fail() {
echo "error: $@"
exit 1
}
install() {
# apt (debian / ubuntu)
if which aptitude >/dev/null 2>&1; then
sudo aptitude install -y "$@"
# homebrew (os x)
elif which brew >/dev/null 2>&1; then
brew install "$@"
# 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 || fail "Failed to install zsh & git."
cd ~
if ! [[ -d config ]]; then
git clone git://github.com/samsonjs/config || fail "cannot clone config repo"
fi
cd config
./init.sh
cd ..
echo " * Done!"
# FIXME figure out how to change the shell semi-interactively (only type in password)
if ! grep `id -u` /etc/passwd | grep zsh; then
#chsh -s `which zsh`
echo " *** Use chsh to change your shell to `which zsh`"
fi