diff --git a/custom_boot.sh b/custom_boot.sh new file mode 100755 index 0000000..5338184 --- /dev/null +++ b/custom_boot.sh @@ -0,0 +1,46 @@ +#!/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