2024-10-31 20:03:00 +00:00
|
|
|
From e391c64afd187a81861301c949db5ffd1f9a3e5d Mon Sep 17 00:00:00 2001
|
2024-08-28 16:36:00 +00:00
|
|
|
From: Philipp Rudo <prudo@redhat.com>
|
|
|
|
Date: Mon, 26 Aug 2024 15:29:01 +0200
|
2024-10-31 20:03:00 +00:00
|
|
|
Subject: [PATCH 30/32] fix(squash-lib): harden against empty $initdir
|
2024-08-28 16:36:00 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|