aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2023-01-25 15:24:31 +0100
committerKarel Kočí <cynerd@email.cz>2023-01-25 15:24:31 +0100
commit8e6e3d387a6f9f622f1d84c444924d61069f7af3 (patch)
treedde4c803d458fd6a87aa243bd1838c69cd2b62e7
parente296418596d0387fa98814b0b12612e4e2df61b4 (diff)
downloadnixos-personal-8e6e3d387a6f9f622f1d84c444924d61069f7af3.tar.gz
nixos-personal-8e6e3d387a6f9f622f1d84c444924d61069f7af3.tar.bz2
nixos-personal-8e6e3d387a6f9f622f1d84c444924d61069f7af3.zip
tools/install.sh: import unshare from nixos-enter
This even causes nixos-enter to use our unshare as we use the same enviroment variable.
-rwxr-xr-xtools/install.sh9
1 files changed, 9 insertions, 0 deletions
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