diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2009-02-03 17:18:54 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2009-02-03 17:18:54 +0100 |
commit | 67a3d160f29d647356ecb3c2c3d71da5673b967c (patch) | |
tree | 475ed26dd214a133167fb6c61a70bedde4ff896b /godot.sh | |
parent | 3d56311689301442d6875b150a1c2a6fb1c404ee (diff) | |
download | dotfiles-67a3d160f29d647356ecb3c2c3d71da5673b967c.tar.gz dotfiles-67a3d160f29d647356ecb3c2c3d71da5673b967c.tar.xz dotfiles-67a3d160f29d647356ecb3c2c3d71da5673b967c.zip |
created godot.sh, symlink-mapping
Diffstat (limited to '')
-rwxr-xr-x | godot.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/godot.sh b/godot.sh new file mode 100755 index 0000000..629a1cd --- /dev/null +++ b/godot.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# target dir of dotfiles (relative to $HOME) +TARGET=".dotfiles" + +if [[ ! -e "${HOME}/${TARGET}" ]]; then + git clone git://git.animux.de/dotfiles.git "${HOME}/${TARGET}" +fi + +pushd $HOME >/dev/null + +# create new symlinks as specified in dotfiles mapping file: +grep -v "^#\|^$" "${TARGET}/symlink-mapping" | \ + grep "[^ \t]\+ -> [^ \t]\+" | \ + awk -F " -> " '{ print $1 ; print "'$TARGET'/"$2; }' | \ + while read target ; read source ; do + if [[ -e "${target}" && ! -f "${target}" && ! -L "${target}" ]]; then + echo "!!! ~/${target}/ exists and is not a symlink." + else + # remove folder (only if they are symlinks) and regular files + # (all other actions could be dangerouse: e.g. lost private keys) + [[ -L "${target}" || -f "${target}" ]] && rm -f "${target}" + + # create ne symlink + ln -s "${source}" "${target}" + fi + done + +popd >/dev/null + +echo +echo "All done. Happy hacking ;)" +echo |