]> xenbits.xensource.com Git - livepatch-build-tools.git/commitdiff
livepatch-build-tools: fix misuse of script directory as work directory
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 13 Dec 2023 13:51:47 +0000 (14:51 +0100)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 13 Dec 2023 16:07:46 +0000 (16:07 +0000)
It's incorrect to assume that the script directory will always match the
directory the script is executed from.  Instead cache the directory at the
start of script execution in order to be able to get back to it if needed.

Fixes: 629ab8ddb775 ('livepatch-build-tools: do not use readlink -m option')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
livepatch-build

index e2ccce4f7fd7a2bc90055aa7a879932e0035660f..cdb852cc7fea1e91d2f3e96bbc8a82f18350d98f 100755 (executable)
@@ -25,6 +25,7 @@
 # script.
 
 SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
+WORKDIR="$(readlink -f -- .)"
 CPUS="$(getconf _NPROCESSORS_ONLN)"
 DEBUG=n
 XEN_DEBUG=n
@@ -455,7 +456,7 @@ if [ "${SKIP}" != "build" ]; then
 fi
 
 if [ "${SKIP}" != "diff" ]; then
-    cd "${SCRIPTDIR}" || die
+    cd "${WORKDIR}" || die
     [ -d "$outputarg" ] || die "Output directory does not exist"
     OUTPUT="$(readlink -f -- "$outputarg")"