chiark / gitweb /
Mirroring: dgit-mirror-rsync copes with invocation via relative pathname
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Jul 2015 16:36:34 +0000 (17:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 11 Jul 2015 18:31:19 +0000 (19:31 +0100)
infra/dgit-mirror-rsync

index 5b54d16..9afd39f 100755 (executable)
@@ -37,6 +37,13 @@ fail () {
 if [ $# -lt 2 ]; then fail "too few arguments"; fi
 
 self=$0
+
+case "$self" in
+/*)                            ;;
+*/*)   self="$PWD/$self"       ;;
+*)                             ;;
+esac
+
 distrodir=$1;  shift
 action=$1;     shift
 package=$1
@@ -79,7 +86,7 @@ reinvoke () {
 
        exec                                                    \
        "$@"                                                    \
-       "$0"    "$distrodir" "reinvoke$newaction" "$package"
+       "$self" "$distrodir" "reinvoke$newaction" "$package"
 }
 
 check-package-mirrorable () {