summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-09 00:04:48 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-09 00:52:02 +0200
commit4fc151b5a3c749833554379a96bd87676f6c5740 (patch)
tree14a62675151cc14645867df383ffd7c4a940d177 /nixos/modules/installer
parent8919d736a034c85eb3e38bc3d9baedcb00356e4e (diff)
downloadnixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar.gz
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar.bz2
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar.lz
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar.xz
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.tar.zst
nixlib-4fc151b5a3c749833554379a96bd87676f6c5740.zip
nixos-install: Ask the user to set a root password
This removes the need to have an initially empty root password.
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-install.sh20
1 files changed, 18 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-install.sh b/nixos/modules/installer/tools/nixos-install.sh
index 1b481d4c65f9..e708521c93f6 100644
--- a/nixos/modules/installer/tools/nixos-install.sh
+++ b/nixos/modules/installer/tools/nixos-install.sh
@@ -73,16 +73,18 @@ fi
 # Mount some stuff in the target root directory.  We bind-mount /etc
 # into the chroot because we need networking and the nixbld user
 # accounts in /etc/passwd.  But we do need the target's /etc/nixos.
-mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/etc
+mkdir -m 0755 -p $mountPoint/dev $mountPoint/proc $mountPoint/sys $mountPoint/etc $mountPoint/run
 mkdir -m 01777 -p $mountPoint/tmp
 mkdir -m 0755 -p $mountPoint/tmp/root
-mkdir -m 0755 -p $mountPoint/var
+mkdir -m 0755 -p $mountPoint/var/setuid-wrappers
 mount --rbind /dev $mountPoint/dev
 mount --rbind /proc $mountPoint/proc
 mount --rbind /sys $mountPoint/sys
 mount --rbind / $mountPoint/tmp/root
 mount --bind /etc $mountPoint/etc
 mount --bind $mountPoint/tmp/root/$mountPoint/etc/nixos $mountPoint/etc/nixos
+mount -t tmpfs -o "mode=0755" none $mountPoint/run
+mount -t tmpfs -o "mode=0755" none $mountPoint/var/setuid-wrappers
 
 
 # Create the necessary Nix directories on the target device, if they
@@ -215,3 +217,17 @@ touch $mountPoint/etc/NIXOS
 echo "finalising the installation..."
 NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
     /nix/var/nix/profiles/system/bin/switch-to-configuration boot
+
+
+# Run the activation script.
+chroot $mountPoint /nix/var/nix/profiles/system/activate
+
+
+# Ask the user to set a root password.
+if [ -t 0 ] ; then
+    echo "setting root password..."
+    chroot $mountPoint passwd
+fi
+
+
+echo "installation finished!"