52 lines
1.3 KiB
Bash
Executable file
52 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
fail() {
|
|
echo "error: $@"
|
|
exit 1
|
|
}
|
|
|
|
if ! which zsh >/dev/null 2>&1; then
|
|
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
|
|
echo "Don't know how to install zsh on this box. Install zsh and run this again."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! which git >/dev/null 2>&1; then
|
|
if which aptitude >/dev/null 2>&1; then
|
|
sudo aptitude install -y git-core
|
|
elif which brew >/dev/null 2>&1; then
|
|
brew install git-core
|
|
else
|
|
echo "Don't know how to install git on this box. Install git and run this again."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
cd ~
|
|
if ! [ -d config ]; then
|
|
git clone git://github.com/samsonjs/config || fail "cannot clone config repo"
|
|
fi
|
|
|
|
for FILE in config/*; do
|
|
DOTFILE=".${FILE##*/}"
|
|
if [ -e "$DOTFILE" ]; then
|
|
mkdir original-dot-files >/dev/null 2>/dev/null
|
|
echo "Existing file found at $DOTFILE, moving to ~/original-dot-files."
|
|
mv "$DOTFILE" original-dot-files/
|
|
fi
|
|
ln -s "$FILE" "$DOTFILE"
|
|
done
|
|
|
|
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
|
|
|