]> gitweb.fluxo.info Git - hydra.git/commitdiff
Provision: fix GRUB install issues
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Aug 2018 22:05:15 +0000 (19:05 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 17 Aug 2018 22:05:15 +0000 (19:05 -0300)
share/hydractl/provision

index ffbcce8203db24fb7d4184dfa00035b6e7d6ddb5..192ae694e88ef4e0515643bde4ed43fdcdf2a717 100755 (executable)
@@ -336,9 +336,11 @@ hydra_sudo_run LC_ALL=C DEBIAN_FRONTEND=noninteractive debootstrap --force-check
 
 # Initial configuration.
 echo "Applying initial configuration..."
-hydra_sudo_run mount none -t proc $WORK/proc
-hydra_sudo_run mount none -t sysfs $WORK/sys
-hydra_sudo_run mount -o bind /dev/ $WORK/dev
+hydra_sudo_run mount none -t proc     $WORK/proc
+hydra_sudo_run mount none -t sysfs    $WORK/sys
+hydra_sudo_run mount -o bind /run/    $WORK/run
+hydra_sudo_run mount -o bind /dev/    $WORK/dev
+hydra_sudo_run mount -o bind /dev/pts $WORK/dev/pts
 echo LANG=C | $SUDO tee $WORK/etc/default/locale > /dev/null
 
 # Resolver configuration.
@@ -467,6 +469,14 @@ else
   kernel_arch="$arch"
 fi
 
+# Boot device must be available before installing kernel and initramfs.
+if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then
+  echo "Boot device setup..."
+  hydra_sudo_run mkfs.ext4 $boot_device
+  hydra_sudo_run mount $boot_device $WORK/boot
+  echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null
+fi
+
 # Kernel.
 $APT_INSTALL linux-image-$kernel_arch -y
 
@@ -480,14 +490,6 @@ hydra_sudo_run chroot $WORK update-initramfs -u
 
 # Grub.
 if [ "$grub" == "y" ]; then
-  echo "Boot device setup..."
-
-  if [ "$encrypt" != "y" ]; then
-    hydra_sudo_run mkfs.ext4 $boot_device
-    hydra_sudo_run mount $boot_device $WORK/boot
-    echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null
-  fi
-
   echo "Setting up GRUB..."
   $APT_INSTALL grub-pc -y
 
@@ -545,7 +547,7 @@ if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then
   hydra_sudo_run umount $WORK/boot
 fi
 
-hydra_sudo_run umount $WORK/sys $WORK/proc $WORK/dev $WORK
+hydra_sudo_run umount $WORK/sys $WORK/proc $WORK/dev/pts $WORK/dev $WORK/run $WORK
 
 if [ "$swap_size" != "0" ]; then
   hydra_sudo_run cryptsetup luksClose provision-swap