41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
|
From 85235ab58df8343a1a0314333b360648a5d0f452 Mon Sep 17 00:00:00 2001
|
||
|
From: Philipp Rudo <prudo@redhat.com>
|
||
|
Date: Mon, 26 Aug 2024 15:29:01 +0200
|
||
|
Subject: [PATCH 35/35] fix(squash-lib): harden against empty $initdir
|
||
|
|
||
|
The postinstall phase of 99squash-lib has the potential to delete the
|
||
|
whole rootfs if $initdir is empty. This should(tm) never happen.
|
||
|
Nevertheless as the consequences are so devastating it is better to
|
||
|
double check.
|
||
|
|
||
|
Signed-off-by: Philipp Rudo <prudo@redhat.com>
|
||
|
(cherry picked from commit 6b089c70761c81a7b82a1bfba5f2c1faef7e972f)
|
||
|
|
||
|
Resolves: RHEL-43460
|
||
|
---
|
||
|
modules.d/99squash-lib/module-setup.sh | 8 ++++++++
|
||
|
1 file changed, 8 insertions(+)
|
||
|
|
||
|
diff --git a/modules.d/99squash-lib/module-setup.sh b/modules.d/99squash-lib/module-setup.sh
|
||
|
index 6a0b6f85..be3d3dc0 100755
|
||
|
--- a/modules.d/99squash-lib/module-setup.sh
|
||
|
+++ b/modules.d/99squash-lib/module-setup.sh
|
||
|
@@ -72,6 +72,14 @@ squash_install() {
|
||
|
squash_installpost() {
|
||
|
local _file _handler
|
||
|
|
||
|
+ # this shouldn't happen but...
|
||
|
+ # ...better safe than deleting your rootfs
|
||
|
+ if [[ -z $initdir ]]; then
|
||
|
+ #shellcheck disable=SC2016
|
||
|
+ dfatal '$initdir not set. Something went terribly wrong.'
|
||
|
+ exit 1
|
||
|
+ fi
|
||
|
+
|
||
|
_handler=$(squash_get_handler)
|
||
|
[[ -n $_handler ]] || return 1
|
||
|
|
||
|
--
|
||
|
2.42.0
|
||
|
|