Skip to content

Instantly share code, notes, and snippets.

Last active Jul 11, 2021
What would you like to do?
# Take in and validate jail name from user
if [[ -z ${JAIL_NAME} ]]; then
>&2 echo "Error: jail name is unset"
exit 1
echo "jail name will be '$JAIL_NAME'"
# Packages to install by default on the new jail
# We're installing vim and neovim (for options), as well as java and mono just in case we want to do any C# stuff
echo '{"pkgs":["mediainfo","sqlite3","ca_root_nss","curl","wget","git","vim","zsh","neovim","nano","java/openjdk8","mono"]}' >/tmp/pkg.json
# Create new jail with default params
iocage create --name=$JAIL_NAME --release=12.2-RELEASE --pkglist=/tmp/pkg.json defaultrouter="" dhcp="on" vnet="on" bpf="on" allow_raw_sockets="1" allow_tun="on" boot="on"
# Commands to run on newly created jail
# Install Oh My Zsh and set it as the default shell experience
echo "Installing Oh My ZSH"
iocage exec $JAIL_NAME -- "pkg update --force --quiet"
iocage exec $JAIL_NAME -- "wget; sh"
iocage exec $JAIL_NAME -- "wget"
iocage exec $JAIL_NAME -- "pkg install mono-"
iocage exec $JAIL_NAME -- "chsh -s $(which zsh) $(whoami)"
# Exit successfully
echo "Exiting"
iocage exec $JAIL_NAME -- "exit 0"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment