fix chboot options
[automated-distro-installer] / chboot
diff --git a/chboot b/chboot
index 12befb8a13ab80d68e7f950d12af22e3f24ffb7c..b90b9261187bd5ab6aaff97110a88cb819ad822e 100755 (executable)
--- a/chboot
+++ b/chboot
@@ -44,7 +44,7 @@ grub_extn=4
 
 ###### begin command line parsing #####
 reboot=true
-temp=$(getopt -l opt o "$@") || usage 1
+temp=$(getopt -l help hdr "$@") || usage 1
 eval set -- "$temp"
 while true; do
     case $1 in
@@ -61,7 +61,8 @@ distro=$1
 
 if [[ ! $distro ]]; then
     echo "available distros:"
-    btrfs subvolume list /boot | sed -rn 's/^.*boot_(.*)/\1/p'
+    cur=$(btrfs subvol show /boot| sed -rn 's/^.*Name:\s*(\S*).*/\1/p')
+    btrfs subvolume list /boot | awk '{print $9}' | sed "s/$cur/$cur (current)/"
     exit 0
 fi
 
@@ -98,7 +99,8 @@ e grub-bios-setup -d $mount_point/grub/i386-pc -s -m $mount_point/grub/device.ma
 e umount $mount_point
 
 e mount $boot_disk$grub_extn $mount_point
-e grub-editenv $mount_point/grubenv set default_subvol=/boot_$distro
+e grub-editenv $mount_point/grubenv set last_boot=/boot_$distro
+e grub-editenv $mount_point/grubenv set did_fai_check=true
 e umount $mount_point
 e rmdir $mount_point