summaryrefslogtreecommitdiff
path: root/run-script
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-05-04 05:41:44 +0200
committerGuillem Jover <guillem@debian.org>2015-05-09 06:19:39 +0200
commit1e61694dcd22ac8b16b55325c31ccc4bcf312f1b (patch)
tree365b1f7de36d90f5af158df5b4b6a88126b580b9 /run-script
parentde6bbfc869da500094a584d95c8d584ae5f75dea (diff)
downloaddpkg-1e61694dcd22ac8b16b55325c31ccc4bcf312f1b.tar.gz
build: Allow running scripts from outside the source tree
Diffstat (limited to 'run-script')
-rwxr-xr-xrun-script12
1 files changed, 9 insertions, 3 deletions
diff --git a/run-script b/run-script
index cebab5b69..0832f904d 100755
--- a/run-script
+++ b/run-script
@@ -5,9 +5,15 @@ top_srcdir=`dirname $0`
# To avoid using «readlink -f» or «realpath» we just change into the
# desired directory and work from there.
cd "$top_srcdir"
+cwd=`pwd`
+cd "$OLDPWD"
# Set up the environment, to use local perl modules and data files.
-export PERL5LIB=`pwd`/scripts:`pwd`/dselect/methods
-export DPKG_DATADIR=`pwd`
+export PERL5LIB=$cwd/scripts:$cwd/dselect/methods
+export DPKG_DATADIR=$cwd
-exec "$@"
+interp=$1
+script=$2
+shift 2
+
+exec $interp "$cwd/$script" "$@"