From 0aaa053cc30a3c879782e053a7b26627e00b0925 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Wed, 14 Dec 2022 10:02:00 +0800 Subject: [PATCH] dracut-module-setup.sh: stop overwriting dracut's trap handler Resolves: bz2151832 Upstream: Fedora Conflict: None commit b45896c62096f7fcfd65afffb4cd93a3ae5f8b1a Author: Coiby Xu Date: Tue Dec 6 18:18:32 2022 +0800 dracut-module-setup.sh: stop overwriting dracut's trap handler Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2149246 Latest Workstation live x86_64 image has an excess increase of ~300 MB in size. This is because kdumpbase module's trap handler overwrites dracut's handler and DRACUT_TMPDIR which has three unpacked initramfs files fails to be cleaned up. This patch moves kdumpbase module's temporary folder under DRACUT_TMPDIR and lets dracut's trap handler do the cleanup instead. Fixes: d25b1ee3 ("Add functions to copy NetworkManage connection profiles to the initramfs") Signed-off-by: Coiby Xu Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu --- dracut-module-setup.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 31ba063..4e77320 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -1,6 +1,6 @@ #!/bin/bash -_DRACUT_KDUMP_NM_TMP_DIR="/tmp/$$-DRACUT_KDUMP_NM" +_DRACUT_KDUMP_NM_TMP_DIR="$DRACUT_TMPDIR/$$-DRACUT_KDUMP_NM" _save_kdump_netifs() { unique_netifs[$1]=1 @@ -10,13 +10,6 @@ _get_kdump_netifs() { echo -n "${!unique_netifs[@]}" } -cleanup() { - rm -rf "$_DRACUT_KDUMP_NM_TMP_DIR" -} - -# shellcheck disable=SC2154 # known issue of shellcheck https://github.com/koalaman/shellcheck/issues/1299 -trap 'ret=$?; cleanup; exit $ret;' EXIT - kdump_module_init() { if ! [[ -d "${initdir}/tmp" ]]; then mkdir -p "${initdir}/tmp"