X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=chboot;fp=chboot;h=40f509367cb64fbc5d9a40b990757cb0601101c5;hb=11f823d2d74425b6ff3143ec0106e2504346f496;hp=37d2516bb1cf941753a949b6ff9a0259b4592470;hpb=08420220e949029a0d2e211edcc93c0701b23429;p=automated-distro-installer diff --git a/chboot b/chboot index 37d2516..40f5093 100755 --- a/chboot +++ b/chboot @@ -1,7 +1,8 @@ #!/bin/bash -x # Set grub to boot into a different distro, and reboot unless -r -# $0 DISTRO_NAME +# $0 [DISTRO_NAME] +# with no argument, print available distros # DISTRO_NAME is based on the partition names in /boot. eg boot_debianjessie @@ -23,6 +24,12 @@ distro=$1 ###### end command line parsing ##### +if [[ ! $distro ]]; then + echo "available distros:" + btrfs subvolume list /boot | sed -rn 's/^.*boot_(.*)/\1/p' + exit 0 +fi + if ! btrfs subvolume list /boot | grep "_$distro$" &>/dev/null; then echo "$0: error: _$distro$ not found in btrfs subvolume list /boot:" btrfs subvolume list /boot