From 8e6e3d387a6f9f622f1d84c444924d61069f7af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 25 Jan 2023 15:24:31 +0100 Subject: tools/install.sh: import unshare from nixos-enter This even causes nixos-enter to use our unshare as we use the same enviroment variable. --- tools/install.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools') diff --git a/tools/install.sh b/tools/install.sh index 254b93b..5a10830 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -13,6 +13,15 @@ if ! command -v git >/dev/null; then exec nix shell 'nixpkgs#git' -c "$0" "$@" fi +# This is copied over from nixos-enter and prevents usage of two unshares +if [ -z "$NIXOS_ENTER_REEXEC" ]; then + export NIXOS_ENTER_REEXEC=1 + exec unshare --fork --mount --uts --mount-proc --pid -- "$0" "$@" +else + mount --make-rprivate / +fi + +################################################################################ if [ ! -s "$root/.personal-secrets.key" ]; then echo "Please paste the personal secret key (terminate using ^D)" >&2 sudo tee "$root/.personal-secrets.key" >/dev/null -- cgit v1.2.3