misc new stuff
[automated-distro-installer] / install-chboot
index d066101642454420d7664649dbc1f9fc88d61104..acb6531f835a1888963070e41ea42215ae0309dc 100755 (executable)
 
 [[ $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 "$@"; "$@"; }
 
@@ -38,6 +48,7 @@ for dir in $mount_point/*; do
     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