From 7800310ce5bf16f0cf6c9f1618f4204db48dc9f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 11 Jul 2019 11:22:49 +0200 Subject: [PATCH] efiboot: add new mount namespace helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to re-execute the currently running script in an unshared mount name space. Co-Developed-By: Thomas Lamprecht Signed-off-by: Fabian Grünbichler --- efiboot/functions | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/efiboot/functions b/efiboot/functions index cb6cd62..79062d8 100755 --- a/efiboot/functions +++ b/efiboot/functions @@ -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 +}