Browse Source

session reload fork and kill on exit

main
pvincent 10 months ago
parent
commit
e595160303
  1. 18
      lib/install.sh

18
lib/install.sh

@ -12,11 +12,6 @@ NEW_GROUP=lxd
readonly NEW_GROUP EXPANDED_CONF
on_exit() {
if [[ "$SESSION_RELOAD_REQUIRED" == true ]]; then
echo "======================================================"
echo "Session Reload is required (due to new group <$NEW_GROUP>)"
echo "======================================================"
fi
if [ -n "${1:-}" ]; then
echo "Aborted by $1"
elif [ "${status:-}" -ne 0 ]; then
@ -32,8 +27,12 @@ function prepare_lxd {
echo "define lxd and assign to user <$USER>"
sudo groupadd --force "$NEW_GROUP"
sudo usermod --append --groups "$NEW_GROUP" "$(whoami)"
exec sg "$NEW_GROUP" -c "$0 SESSION_RELOAD_REQUIRED $TARGET $@"
sg "$NEW_GROUP" -c "$0 SESSION_RELOAD_REQUIRED $TARGET $@"
sg "$NEW_GROUP" -c bash
kill -9 "$PPID"
# no further processing because exec has been called!
else
echo "user <$USER> already belongs to group <lxd>!"
fi
@ -432,10 +431,9 @@ else
extra_dev_desktop
if [[ "$SESSION_RELOAD_REQUIRED" == true ]]; then
echowarn "current session has been reloaded, due to new group <$NEW_GROUP>."
echowarn "be aware to exit twice or fully disconnect/reconnect to take advantage of new group <$NEW_GROUP>!"
echoinfo "successful session installation "
sg $NEW_GROUP -c bash
echoinfo "successful session installation"
echowarn "be aware: the current session has been reloaded, due to new group <$NEW_GROUP>."
echowarn "-> exit means kill!"
else
echoinfo "successful installation"
fi

Loading…
Cancel
Save