From 1710a09f6aa9ebd6d750b8777a5db22f61cea2cc Mon Sep 17 00:00:00 2001 From: Lucas Holt Date: Fri, 26 Feb 2021 16:55:56 -0500 Subject: [PATCH] Add preliminary support for MidnightBSD. --- usr/local/etc/bastille/bastille.conf.sample | 1 + usr/local/share/bastille/bootstrap.sh | 7 +++++++ usr/local/share/bastille/create.sh | 5 +++++ usr/local/share/bastille/pkg.sh | 6 +++++- usr/local/share/bastille/update.sh | 5 +++++ usr/local/share/bastille/upgrade.sh | 5 +++++ usr/local/share/bastille/verify.sh | 4 ++++ 7 files changed, 32 insertions(+), 1 deletion(-) diff --git a/usr/local/etc/bastille/bastille.conf.sample b/usr/local/etc/bastille/bastille.conf.sample index 344268e1..08bbfb0f 100644 --- a/usr/local/etc/bastille/bastille.conf.sample +++ b/usr/local/etc/bastille/bastille.conf.sample @@ -33,6 +33,7 @@ bastille_resolv_conf="/etc/resolv.conf" ## default ## bootstrap urls bastille_url_freebsd="http://ftp.freebsd.org/pub/FreeBSD/releases/" ## default: "http://ftp.freebsd.org/pub/FreeBSD/releases/" bastille_url_hardenedbsd="http://installer.hardenedbsd.org/pub/hardenedbsd/" ## default: "https://installer.hardenedbsd.org/pub/HardenedBSD/releases/" +bastille_url_midnightbsd="https://www.midnightbsd.org/ftp/MidnightBSD/releases/" ## default: "https://www.midnightbsd.org/pub/MidnightBSD/releases/" ## ZFS options bastille_zfs_enable="" ## default: "" diff --git a/usr/local/share/bastille/bootstrap.sh b/usr/local/share/bastille/bootstrap.sh index e0d2cf76..bac958c9 100644 --- a/usr/local/share/bastille/bootstrap.sh +++ b/usr/local/share/bastille/bootstrap.sh @@ -363,6 +363,13 @@ fi ## Filter sane release names case "${1}" in +2.[0-9]*) + ## check for MidnightBSD releases name + NAME_VERIFY=$(echo ${RELEASE}) + UPSTREAM_URL="${bastille_url_midnightbsd}${HW_MACHINE_ARCH}/${NAME_VERIFY}" + PLATFORM_OS="MidnightBSD" + validate_release_url + ;; *-CURRENT|*-current) ## check for FreeBSD releases name NAME_VERIFY=$(echo "${RELEASE}" | grep -iwE '^([1-9]{2,2})\.[0-9](-CURRENT)$' | tr '[:lower:]' '[:upper:]') diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 1562d600..c0c81d41 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -481,6 +481,11 @@ fi if [ -z "${EMPTY_JAIL}" ]; then ## verify release case "${RELEASE}" in + 2.[0-9]*) + ## check for MidnightBSD releases name + NAME_VERIFY=$(echo "${RELEASE}") + validate_release + ;; *-CURRENT|*-CURRENT-I386|*-CURRENT-i386|*-current) ## check for FreeBSD releases name NAME_VERIFY=$(echo "${RELEASE}" | grep -iwE '^([1-9]{2,2})\.[0-9](-CURRENT|-CURRENT-i386)$' | tr '[:lower:]' '[:upper:]' | sed 's/I/i/g') diff --git a/usr/local/share/bastille/pkg.sh b/usr/local/share/bastille/pkg.sh index 03e82702..dd70cd49 100644 --- a/usr/local/share/bastille/pkg.sh +++ b/usr/local/share/bastille/pkg.sh @@ -47,6 +47,10 @@ fi for _jail in ${JAILS}; do info "[${_jail}]:" - jexec -l "${_jail}" /usr/sbin/pkg "$@" + if [ -f ${_jail}/usr/sbin/pkg ]; then + jexec -l "${_jail}" /usr/sbin/pkg "$@" + else + jexec -l "${_jail}" /usr/sbin/mport "$@" + fi echo done diff --git a/usr/local/share/bastille/update.sh b/usr/local/share/bastille/update.sh index 848f12d6..9a56628e 100644 --- a/usr/local/share/bastille/update.sh +++ b/usr/local/share/bastille/update.sh @@ -64,6 +64,11 @@ if [ "${TARGET}" = "ALL" ]; then error_exit "Batch upgrade is unsupported." fi +if [ -f /bin/midnightbsd-version ]; then + echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" + exit 1 +fi + if freebsd-version | grep -qi HBSD; then error_exit "Not yet supported on HardenedBSD." fi diff --git a/usr/local/share/bastille/upgrade.sh b/usr/local/share/bastille/upgrade.sh index 52c9c295..41e4ae57 100644 --- a/usr/local/share/bastille/upgrade.sh +++ b/usr/local/share/bastille/upgrade.sh @@ -55,6 +55,11 @@ if [ "${TARGET}" = "ALL" ]; then error_exit "Batch upgrade is unsupported." fi +if [ -f /bin/midnightbsd-version ]; then + echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" + exit 1 +fi + if freebsd-version | grep -qi HBSD; then error_exit "Not yet supported on HardenedBSD." fi diff --git a/usr/local/share/bastille/verify.sh b/usr/local/share/bastille/verify.sh index 35be046b..da88ee5e 100644 --- a/usr/local/share/bastille/verify.sh +++ b/usr/local/share/bastille/verify.sh @@ -36,6 +36,10 @@ bastille_usage() { } verify_release() { + if [ -f /bin/midnightbsd-version ]; then + echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" + exit 1 + fi if freebsd-version | grep -qi HBSD; then error_exit "Not yet supported on HardenedBSD." fi