#!/usr/bin/bash usage() { echo "Usage: $0 [ -d dirname ]" >&2 echo "ex: $0 -d /zones/boot/boot-20220113T011608Z" exit 1 } while getopts ":d:" opt; do case "$opt" in d) DIR=$OPTARG ;; \?) echo "Error: Invalid Option: -${OPTARG}" >&2 usage ;; :) echo "Error: -${OPTARG} requires an argument." usage ;; *) usage ;; esac done shift $((OPTIND -1 )) if [ -z ${DIR} ]; then usage fi mkdir -p $DIR/bootfs/etc cp /etc/system $DIR/bootfs/etc/ echo 'set ngroups_max=1024' >> $DIR/bootfs/etc/system cat << EOF >> $DIR/loader.conf.local etc_system_load=YES etc_system_type=file etc_system_name=/boot/bootfs/etc/system etc_system_flags="name=/etc/system" EOF