diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-12 00:00:53 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-02-12 00:00:53 +0100 |
commit | 93582ceecff2272d070aab2915fcab10fd22ed16 (patch) | |
tree | 991b234468eaed2d2bf4873238d3f183ab569402 /install | |
parent | d1dd8750540a680b3de13f9fbaec76951c9bb173 (diff) | |
download | bin-93582ceecff2272d070aab2915fcab10fd22ed16.zip bin-93582ceecff2272d070aab2915fcab10fd22ed16.tar.gz |
install: factorize
Diffstat (limited to 'install')
-rwxr-xr-x | install | 36 |
1 files changed, 17 insertions, 19 deletions
@@ -4,32 +4,30 @@ DEST_DIR=$HOME/bin DONOTDO="install bashrc solarized xkb-jeyzu.patch" +function link () +{ + dst="$2" + ff=$(readlink -f "$1") + bf=$(readlink -e "$dst") + if [ "$bf" != "$ff" ]; then + echo "fix $bf" + rm "$dst" 2>/dev/null + fi + if [ ! -e "$dst" ]; then + ln -s "$ff" "$dst" + ls -l "$dst" + fi +} + rm *~ 2>/dev/null for f in *; do echo $DONOTDO | grep -q $f 2>/dev/null [ $? -eq 0 ] && continue - ff=$(readlink -f $f) - if [ ! -e $DEST_DIR/$f ]; then - echo "symlink $DEST_DIR/$f" && ln -s $ff $DEST_DIR/$f - else - bf=$(readlink -e $DEST_DIR/$f) - if [ "$bf" != "$ff" ]; then - echo "$bf is not OK" - fi - fi + link "$f" "$DEST_DIR/$f" done for f in bashrc; do - ff=$(readlink -f $f) - dst="$HOME/.$f" - if [ ! -e "$dst" ]; then - echo "symlink $dst" && ln -s "$ff" "$dst" - else - bf=$(readlink -e "$dst") - if [ "$bf" != "$ff" ]; then - echo "$bf is not OK" - fi - fi + link "$f" "$HOME/.$f" done ff=$(readlink -f solarized/dircolors.ansi-dark) |