X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=lib.sh;h=70be68df0433531e27c5f7ab58e99bf8350a305e;hb=a003c8f197cb3f3c05430fa644dc528c34ab3cd9;hp=ba4e658f978d4033e732b88839577341729e6209;hpb=b1c443c9ab5b960e08e079863d4c679f226871b6;p=config%2Fdotfiles.git diff --git a/lib.sh b/lib.sh index ba4e658..70be68d 100644 --- a/lib.sh +++ b/lib.sh @@ -2,7 +2,7 @@ # # Their setup.sh script sources this file. -# Copyright (C) 2009-2013 Simon Ruderich +# Copyright (C) 2009-2014 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -153,16 +153,15 @@ link() { # Abort if the target file exists and is no symbolic link. Prevents # overwriting real files. - if ( test -f "$target" && test ! -h "$target" ) || \ - ( test -s "$target" && test ! -h "$target" ); then - printf "link(): target '%s' exists already and is no symbolic link!" \ + if test -e "$target" && test ! -h "$target"; then + printf "link(): target '%s' exists already and is no symbolic link!\n" \ "$target" >&2 exit 1 fi - # Make sure the source exists (is file, directory or link). - if test ! -f "$source" && test ! -d "$source" && test ! -h "$source"; then - printf "link(): source '%s' doesn't exist!" "$source" >&2 + # Make sure the source exists. + if test ! -e "$source"; then + printf "link(): source '%s' doesn't exist!\n" "$source" >&2 exit 1 fi