X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=chboot;h=2a357e6d2f1dba5e01d92bdd8fa597a3958cbfd0;hb=708c79e5611549280b988c607e1a1a19fc63e991;hp=eb8b1183011b907165d9f7c5aba21edae0ab9e5c;hpb=ec9227898fa68bd89de454c87bce8ea051a8d783;p=automated-distro-installer diff --git a/chboot b/chboot index eb8b118..2a357e6 100755 --- a/chboot +++ b/chboot @@ -39,6 +39,9 @@ EOF exit $1 } + +grub_extn=4 + ###### begin command line parsing ##### reboot=true temp=$(getopt -l opt o "$@") || usage 1 @@ -58,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 @@ -91,8 +95,12 @@ boot_disk=${boot_dev%%[0-9]*} e grub-bios-setup -d $mount_point/grub/i386-pc -s -m $mount_point/grub/device.map $boot_disk # todo, mount_point needs subvolid=0 -e grub-editenv $mount_point/grub2/grubenv set default_subvol=/boot_$distro +e umount $mount_point + +e mount $boot_disk$grub_extn $mount_point +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