dotfiles/setup.sh

44 lines
943 B
Bash
Raw Normal View History

#!/bin/zsh
2011-05-03 21:53:50 -07:00
dfdir=$(cd "$(dirname "$0")" && pwd)
print -P "%BSymlinking config files%b"
for dotfile in `ls .`
do
2012-04-17 22:37:39 -07:00
# metafiles; don't link them
[ $dotfile = 'setup.sh' ] && continue
2012-04-17 22:37:39 -07:00
[ $dotfile = 'README.md' ] && continue
local dest="$HOME/.$dotfile"
local action='skipped'
if [[ ! -L "$dest" ]]; then
action='linked'
else
action='skipped'
fi
filler=$(($COLUMNS - ${#dest} - ${#action} - 4))
spaces=''
for (( i=0; $i < $filler; i++ )); do spaces="$spaces " done
echo -n " $dest"
if [[ $action = 'linked' ]]; then
ln -fs "$dfdir/$dotfile" "$dest"
action="%F{yellow}$action%f"
else
action="%F{green}$action%f"
fi
print -P "$spaces%F{green}$action%f"
done
echo "touch $HOME/.hushlogin"
touch "$HOME/.hushlogin"
2011-05-03 21:53:50 -07:00
# Initialize submodules
print -P "%BInitializing git submodules%b"
cd "$dfdir"
2011-05-03 21:53:50 -07:00
git submodule init
git submodule update
exit 0