]> gitweb.fluxo.info Git - inception.git/commitdiff
Check if we were called correctly
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 24 Feb 2018 17:20:06 +0000 (14:20 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 24 Feb 2018 17:20:06 +0000 (14:20 -0300)
infection

index c326e82201b21eba51e6e625650ee5977bad3b32..271ce79f17f3d1b6b4b88d63f173cf5da6c49ee3 100755 (executable)
--- a/infection
+++ b/infection
@@ -5,7 +5,7 @@
 
 # Parameters
 BASENAME="`basename $0`"
-DIRNAME="$(cd `dirname $0`/.. &> /dev/null && pwd)"
+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`"
@@ -23,6 +23,14 @@ function infection_usage {
 # Initialize
 function infection_init {
   (
+    # 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
+
     # Check if repo is inside $HOME
     if [ "$DIRNAME" != "$HOME/$SHORTNAME" ]; then
       echo "Please make sure $DIRNAME is moved to $HOME"