diff options
-rwxr-xr-x | infection | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -5,8 +5,6 @@ # Parameters BASENAME="`basename $0`" -DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)" -SHORTNAME="$(echo $DIRNAME | sed -e "s|$HOME/||")" EXCLUDES="--exclude=local --exclude=stowpkg/tree" DATE="`date +%Y%m%d%I%M%S`" BACKUPS="$HOME/.backups/$DATE" @@ -22,14 +20,23 @@ function infection_usage { # Initialize function infection_init { + # Set dir and base names depending on the way the program was called (symlink or direct) + if [ "$(cd `dirname $0` &> /dev/null && dirname `pwd`)" == "inception" ]; then + DIRNAME="$(cd `dirname $0/..` &> /dev/null && pwd)" + else + DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)" + fi + + SHORTNAME="$(echo $DIRNAME | sed -e "s|$HOME/||")" + ( # Check if we were called correctly. Program should be called # from the toplevel repository symlink and not from it's own # repository - if [ ! -d "$DIRNAME/inception" ]; then - echo "Please call me using $DIRNAME/infection" - exit 1 - fi + #if [ ! -d "$DIRNAME/inception" ]; then + # echo "Please call me using $DIRNAME/infection" + # exit 1 + #fi # Check if repo is inside $HOME if [ "$DIRNAME" != "$HOME/$SHORTNAME" ]; then |