Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
Created October 5, 2014 17:16
Show Gist options
  • Save pesterhazy/cb1081f1ff0c886db9fe to your computer and use it in GitHub Desktop.
Save pesterhazy/cb1081f1ff0c886db9fe to your computer and use it in GitHub Desktop.
symlink dotfiles in your dropbox folder to your $HOME
dropbox-update-dotfiles () {
src="$HOME/Dropbox/Linux/dotfiles"
dst="$HOME"
if [[ ! -d "$src" ]]; then
print Using $HOME/dotfiles.
src="$HOME/dotfiles"
fi
if [[ ! -d "$src" ]]; then
print "Directory $src not found."
fi
for f in "$src"/*~*(.swp|~|.pyc)(D); do
if [[ "${f:t}" != ".lein" ]]; then
if [[ -h "$dst/${f:t}" ]]; then
# exists as symlink
elif [[ -e "$dst/${f:t}" ]]; then
print "WARNING: ${f:t} exists, but is not a symlink."
else
ln -sv "$f" "$dst"
fi
fi
done
# update some files manually
#
echo updating manually...
mkdir -p ~/.lein
_try_ln "$src" "$dst" ".lein/profiles.clj"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment