X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=install-chboot;h=041302df3904e109b8b669dfb113551904eb1fda;hb=HEAD;hp=838c0ae02e63565a37963088f8c65490734dc45d;hpb=cfe7d2a4eb0e0af4cd59df420f76ea4d5ee755fd;p=automated-distro-installer diff --git a/install-chboot b/install-chboot index 838c0ae..041302d 100755 --- a/install-chboot +++ b/install-chboot @@ -15,16 +15,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@" +[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +set -e; . /usr/local/lib/bash-bear; set +e -# usage install-chboot: isntalls chboot to all /boot subvols, -# in case there is an issue booting and it is needed. -# Run this when chboot changes. +usage() { + cat <<'EOF' +Usage: isntall-chboot [-h|--help] +reinstall chboot to /boot subvols, for chboot updates. + +We install to /boot in case there is an issue booting and only the /boot +vol is readily available. For the bootstrap subvol, this is the normal +case. +EOF + exit 0 +} +case $1 in + -h|--help) usage ;; +esac -cd "${BASH_SOURCE%/*}" e() { echo "$@"; "$@"; } @@ -33,7 +42,7 @@ mount_point=$(mktemp -d) e mount -o subvolid=0 $boot_dev $mount_point shopt -s nullglob -for dir in $mount_point/*; do +for dir in "$mount_point"/*; do btrfs subvol show $dir &>/dev/null || continue if [[ -e $dir/boot ]]; then dir=$dir/boot