From: Roger Pau Monne Date: Wed, 13 Dec 2023 13:51:47 +0000 (+0100) Subject: livepatch-build-tools: fix misuse of script directory as work directory X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1b5b03b3ce4187ce99bad580fd0ee36c6337313f;p=livepatch-build-tools.git livepatch-build-tools: fix misuse of script directory as work directory 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é Reviewed-by: Ross Lagerwall Signed-off-by: Ross Lagerwall --- diff --git a/livepatch-build b/livepatch-build index e2ccce4..cdb852c 100755 --- a/livepatch-build +++ b/livepatch-build @@ -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")"