From bbe90843813c948dc12d82427017b7242312e295 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 14 Feb 2019 22:01:15 -0200 Subject: Provision: use lsblk instead of blkid --- share/hydractl/provision | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/hydractl/provision b/share/hydractl/provision index 1721a17..24fd614 100755 --- a/share/hydractl/provision +++ b/share/hydractl/provision @@ -524,14 +524,28 @@ fi if [ "$grub" == "y" ] && [ "$encrypt" != "y" ]; then # Use UUID # Reboot device must be calculated after filesystem creation and grub installation + # + # We use lsblk instead of blkid. From blkid(8): + # + # When device is specified, tokens from only this device are displayed. It is + # possible to specify multiple device arguments on the command line. If none + # is given, all devices which appear in /proc/partitions are shown, if they are + # recognized. + # + # Note that blkid reads information directly from devices and for non-root + # users it returns cached unverified information. It is better to use lsblk + # --fs to get a user-friendly overview of filesystems and devices. lsblk(8) + # is also easy to use in scripts. blkid is mostly designed for system services + # and to test libblkid functionality. #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'`" + #reboot_device="`blkid $boot_device | cut -d ' ' -f 2 | sed -e 's/"//g'`" + reboot_device="`lsblk $boot_device -n -o UUID`" # Use device name: might lead to wrong results # During install boot_device might be /dev/sdb2, but on boot 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 + echo "UUID=$reboot_device /boot ext4 defaults,errors=remount-ro 0 2" | $SUDO tee -a $WORK/etc/fstab > /dev/null hydra_sudo_run chroot $WORK update-initramfs -u fi -- cgit v1.2.3