[[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
+cd ${x%/*}
-# 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: ${0##*/} [-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 $1
+}
+case $1 in
+ -h|--help) usage ;;
+esac
-x=$(readlink -f "$BASH_SOURCE"); cd ${x%/*}
e() { echo "$@"; "$@"; }
if [[ -e $dir/boot ]]; then
dir=$dir/boot
fi
+ e install -m 755 -o root -g root bash-trace $dir
e install -m 755 -o root -g root chboot $dir
done
e umount $mount_point