fixes mostly for stable
[automated-distro-installer] / chboot
diff --git a/chboot b/chboot
index 37d2516bb1cf941753a949b6ff9a0259b4592470..40f509367cb64fbc5d9a40b990757cb0601101c5 100755 (executable)
--- 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