From e317c106d3d95ba88f361b5166ce7d12fcb4825d Mon Sep 17 00:00:00 2001 From: pvincent Date: Sat, 2 Mar 2024 17:08:20 +0400 Subject: [PATCH] disable all signals before sudoing lxd group --- lib/functions.sh | 7 +++++++ lib/install.sh | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/functions.sh b/lib/functions.sh index ecf5c64..997d9e1 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -90,6 +90,13 @@ function disable_trace() { trap - ERR } +function disable_all_signals { + trap - ERR + trap - HUP + trap - INT + trap - TERM +} + function prepare_nftables() { local PREFIX="miaou:nftables" diff --git a/lib/install.sh b/lib/install.sh index 9601058..d53697a 100755 --- a/lib/install.sh +++ b/lib/install.sh @@ -30,7 +30,9 @@ function prepare_lxd { realcommand="$MIAOU_BASEDIR/lib/install.sh" sg "$NEW_GROUP" -c "EMAIL=$valid_email $realcommand SESSION_RELOAD_REQUIRED $TARGET" - # sg "$NEW_GROUP" bash + + set +e + disable_all_signals sudo su - "$(whoami)" kill -9 "$PPID" # no further processing because exec has been called!