mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 13:25:45 +02:00
scripts/beesd: Unshare namespace without systemd
If starting the beesd script without systemd, the mount point won't automatically unmount if the script is cancelled with ctrl+c. Fixes: https://github.com/Zygo/bees/issues/281 Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
parent
ad11db2ee1
commit
360ce7e125
@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# if not called from systemd try to replicate mount unsharing on ctrl+c
|
||||
# see: https://github.com/Zygo/bees/issues/281
|
||||
if [ -z "${SYSTEMD_EXEC_PID}" -a -z "${UNSHARE_DONE}" ]; then
|
||||
UNSHARE_DONE=true
|
||||
export UNSHARE_DONE
|
||||
exec unshare -m --propagation private -- "$0" "$@"
|
||||
fi
|
||||
|
||||
## Helpful functions
|
||||
INFO(){ echo "INFO:" "$@"; }
|
||||
ERRO(){ echo "ERROR:" "$@"; exit 1; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user