]> gitweb.fluxo.info Git - hydra.git/commitdiff
Provision: UUID fixes and other enhancements
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Aug 2018 01:55:29 +0000 (22:55 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 18 Aug 2018 01:55:29 +0000 (22:55 -0300)
share/hydractl/provision

index 2bf2307aa471f97b5ca0fbbae406136a20fe1fdc..c791d06067ea122825a303c4bcf73d696f278785 100755 (executable)
@@ -204,21 +204,12 @@ else
 
     boot_device="$device"2
     syst_device="$device"3
-
-    # Use UUID
-    # Give time to devices table be updated
-    sleep 2
-    reboot_device="`blkid | grep ^$boot_device: | cut -d ' ' -f 2 | sed -e 's/"//g'`"
-
-    # Use device name: might lead to wrong results:
-    # During install boot_device might be /dev/sdb2, but on but be /dev/sda2
-    #reboot_device="$boot_device"
   fi
 fi
 
 hydra_sudo_run parted -s -- $device set 2 boot on
 
-# Take a small break to device table be updated
+# Take a small break to devices table be updated
 sleep 2
 
 # Create volumes.
@@ -457,9 +448,9 @@ 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
+  hydra_sudo_run mount     $boot_device $WORK/boot
 fi
 
 # Kernel.
@@ -499,6 +490,9 @@ EOF
   hydra_sudo_run chroot $WORK update-initramfs -u
 else
   $APT_INSTALL dracut -y
+
+  # Ensure initramfs-tools is absent
+  hydra_sudo_run chroot $WORK apt-get autoremove -y
 fi
 
 # Grub.
@@ -526,6 +520,20 @@ if [ "$grub" == "y" ]; then
   fi
 fi
 
+# Set boot partition config
+if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then
+  # Use UUID
+  # Reboot device must be calculated after filesystem creation and grub installation
+  #reboot_device="`blkid | grep ^$boot_device: | cut -d ' ' -f 2 | sed -e 's/"//g'`"
+  reboot_device="`blkid $boot_device | cut -d ' ' -f 2 | sed -e 's/"//g'`"
+
+  # Use device name: might lead to wrong results
+  # During install boot_device might be /dev/sdb2, but on but be /dev/sda2
+  #reboot_device="$boot_device"
+
+  echo "$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null
+fi
+
 # Utils.
 echo "Installing basic utilities..."
 $APT_INSTALL screen cron lsb-release openssl -y
@@ -581,4 +589,9 @@ Now proceeed with final steps:
   - Review fstab, crypttab and optional GRUB configuration.
 
 See https://padrao.fluxo.info/install for more information.
+
+If you know what you're doing, you might test the installation using:
+
+  sudo kvm -m 512 -hda $device
+
 EOF