aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-02-24 14:20:06 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-02-24 14:20:06 -0300
commitff742599329fe20be550d3e42276e7e46ed7d64c (patch)
treedc9b5023e94f8bf7ebc8401d14caa54e1e86fe1d
parent744e7eca5964e766fe78fd2437bf42f3f5b4569c (diff)
downloadinception-ff742599329fe20be550d3e42276e7e46ed7d64c.tar.gz
inception-ff742599329fe20be550d3e42276e7e46ed7d64c.tar.bz2
Check if we were called correctly
-rwxr-xr-xinfection10
1 files changed, 9 insertions, 1 deletions
diff --git a/infection b/infection
index c326e82..271ce79 100755
--- 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"