efiboot: add new mount namespace helper

to re-execute the currently running script in an unshared mount name
space.

Co-Developed-By: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2019-07-11 11:22:49 +02:00 committed by Thomas Lamprecht
parent 58487bcb45
commit 7800310ce5

View File

@ -63,3 +63,12 @@ boot_kernel_list() {
warn() {
echo "$@" 1>&2
}
reexec_in_mountns() {
if [ -z "$PVE_EFIBOOT_UNSHARED" ]; then
export PVE_EFIBOOT_UNSHARED=1
echo "Re-executing '$0' in new private mount namespace.."
unshare --mount --propagation private "$0" "$@"
exit 0
fi
}