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 5b54d16cc0f9a1cdbf0be5251d1943b5f5d3d535..9afd39f1659c62de4114dd84dd9f6ae4a3fdcca7 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 () {