symlink configs from Dropbox if available

This commit is contained in:
Sami Samhuri 2012-03-24 09:51:06 -07:00
parent 65d1d014b3
commit dd3e291d39

13
init.sh
View file

@ -1,16 +1,23 @@
#!/bin/sh #!/bin/bash
BASENAME="${0##*/}" BASENAME="${0##*/}"
if [ x"$1" != x ]; then if [ x"$1" != x ]; then
CONFIG_PATH="$1" CONFIG_PATH="$1"
else elif [ -d "${HOME}/Dropbox/Personal/config" ]; then
CONFIG_PATH="${HOME}/Dropbox/Personal/config"
elif [ -d "${HOME}/config" ]; then
CONFIG_PATH="${HOME}/config" CONFIG_PATH="${HOME}/config"
else
echo "Error: no config dir found"
exit 1
fi fi
link_config() { link_config() {
file="$1" file="$1"
[ -e ".$file" ] || ln -s "${CONFIG_PATH}/$file" ".$file" if [ ! -e "${HOME}/.$file" ]; then
ln -s "${CONFIG_PATH}/$file" "${HOME}/.$file"
fi
} }
CONFIG_FILES="ackrc emacs emacs.d gitconfig screenrc vimrc zshenv gdbinit" CONFIG_FILES="ackrc emacs emacs.d gitconfig screenrc vimrc zshenv gdbinit"