# 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]}" "$@"
-x="$(readlink -f "$BASH_SOURCE")"; source "${x%/*}/bash-trace"
-cd ${x%/*}
+set -e; . /usr/local/lib/bash-bear; set +e
usage() {
- cat <<EOF
-Usage: ${0##*/} [-h|--help]
+ 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 $1
+ exit 0
}
case $1 in
-h|--help) usage ;;
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