From 58ef99f76b0765f88b270b003bc7a516e5b36ec4 Mon Sep 17 00:00:00 2001 From: Joern Siglen Date: Fri, 22 Dec 2023 15:52:49 +0100 Subject: [PATCH] dbginfo.sh: handle relative and absolute calling path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit include the dbginfo.sh script used - enabled for relative paths Reviewed-by: Michael Storzer Signed-off-by: Joern Siglen Signed-off-by: Jan Höppner --- CHANGELOG.md | 1 + scripts/dbginfo.sh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db6ec4d6..28d3d296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Release history for s390-tools (MIT version) - zipl/boot: compile the bootloaders only if HOST_ARCH is s390x - zipl: Add --no-compress option to zipl command - zkey: Also check for deconfigured and check-stopped cards + - dbginfo.sh: fix relative path on script copy Bug Fixes: - ap_tools/ap-check: handle get-attributes between pre and post event diff --git a/scripts/dbginfo.sh b/scripts/dbginfo.sh index f0ae5029..cfcba2bf 100755 --- a/scripts/dbginfo.sh +++ b/scripts/dbginfo.sh @@ -15,6 +15,7 @@ export LC_ALL ######################################## # Global used variables readonly SCRIPTNAME="${0##*/}" # general name of this script +readonly STARTDIR="$(pwd)" # save calling directory # readonly DATETIME="$(date +%Y-%m-%d-%H-%M-%S 2>/dev/null)" readonly DOCKER=$(if type docker >/dev/null 2>&1; then echo "YES"; else echo "NO"; fi) @@ -1411,10 +1412,11 @@ environment_setup() { create_package() { local rc_tar pr_syslog_stdout ${step_num} "Finalizing: Creating archive with collected data" + # get a copy of the script used - enabled for relative path calls + cd "${STARTDIR}" + cp -p "${BASH_SOURCE[0]}" "${WORKPATH}" + # create the archive cd "${WORKDIR_BASE}" - # get a copy of the script used - cp -p $0 "${WORKDIR_CURRENT}" - touch "${WORKARCHIVE}" chmod 0600 "${WORKARCHIVE}" tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"