diff --git a/usr/local/share/bastille/bootstrap.sh b/usr/local/share/bastille/bootstrap.sh index 503a8c83..347a1eff 100644 --- a/usr/local/share/bastille/bootstrap.sh +++ b/usr/local/share/bastille/bootstrap.sh @@ -436,10 +436,10 @@ ubuntu_bionic|bionic|ubuntu-bionic) warn "linprocfs_load, linsysfs_load, tmpfs_load not enabled in /boot/loader.conf or linux_enable not active. Should I do that for you? (N|y)" read answer case $answer in - no|No|n|N|"") + [Nn][Oo]|[Nn]|"") error_exit "Exiting." ;; - yes|Yes|y|Y) + [Yy][Ee][Ss]|[Yy]) info "Loading modules" kldload linux linux64 linprocfs linsysfs tmpfs info "Persisting modules" @@ -456,10 +456,10 @@ ubuntu_bionic|bionic|ubuntu-bionic) warn "Debootstrap not found. Should it be installed? (N|y)" read answer case $answer in - no|No|n|N|"") + [Nn][Oo]|[Nn]|"") error_exit "Exiting. You need to install debootstap before boostrapping a Linux jail." ;; - yes|Yes|y|Y) + [Yy][Ee][Ss]|[Yy]) pkg install -y debootstrap debootstrap --foreign --arch=amd64 --no-check-gpg bionic "${bastille_releasesdir}"/Ubuntu_1804 ;; @@ -474,10 +474,10 @@ ubuntu_focal|focal|ubuntu-focal) warn "linprocfs_load, linsysfs_load, tmpfs_load not enabled in /boot/loader.conf or linux_enable not active. Should I do that for you? (N|y)" read answer case $answer in - no|No|n|N|"") + [Nn][Oo]|[Nn]|"") error_exit "Exiting." ;; - yes|Yes|y|Y) + [Yy][Ee][Ss]|[Yy]) info "Loading modules" kldload linux linux64 linprocfs linsysfs tmpfs info "Persisting modules" @@ -494,10 +494,10 @@ ubuntu_focal|focal|ubuntu-focal) warn "Debootstrap not found. Should it be installed? (N|y)" read answer case $answer in - no|No|n|N|"") + [Nn][Oo]|[Nn]|"") error_exit "Exiting. You need to install debootstap before boostrapping a Linux jail." ;; - yes|Yes|y|Y) + [Yy][Ee][Ss]|[Yy]) pkg install -y debootstrap debootstrap --foreign --arch=amd64 --no-check-gpg focal "${bastille_releasesdir}"/Ubuntu_2004 ;; diff --git a/usr/local/share/bastille/config.sh b/usr/local/share/bastille/config.sh index 12d88280..592ff57b 100644 --- a/usr/local/share/bastille/config.sh +++ b/usr/local/share/bastille/config.sh @@ -76,7 +76,7 @@ for _jail in ${JAILS}; do MATCH_FOUND=$? if [ "${ACTION}" = 'get' ]; then - if [ $MATCH_FOUND -ne 0 ]; then + if [ "${MATCH_FOUND}" -ne 0 ]; then warn "not set" elif ! echo "${MATCH_LINE}" | grep '=' > /dev/null 2>&1; then echo "enabled" @@ -99,7 +99,7 @@ for _jail in ${JAILS}; do LINE=" ${PROPERTY};" fi - if [ $MATCH_FOUND -ne 0 ]; then # No match, so insert the property at the end. -- cwells + if [ "${MATCH_FOUND}" -ne 0 ]; then # No match, so insert the property at the end. -- cwells echo "$(awk -v line="${LINE}" '$0 == "}" { print line; } 1 { print $0; }' "${FILE}")" > "${FILE}" else # Replace the existing value. -- cwells sed -i '' -E "s/ *${ESCAPED_PROPERTY}[ =;].*/${LINE}/" "${FILE}" diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 9acf1347..2b796f48 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -358,8 +358,7 @@ create_jail() { FILE_LIST=".cshrc .profile COPYRIGHT dev etc media mnt net proc root tmp var usr/obj usr/tests" for files in ${FILE_LIST}; do if [ -f "${bastille_releasesdir}/${RELEASE}/${files}" ] || [ -d "${bastille_releasesdir}/${RELEASE}/${files}" ]; then - cp -a "${bastille_releasesdir}/${RELEASE}/${files}" "${bastille_jail_path}/${files}" - if [ "$?" -ne 0 ]; then + if ! cp -a "${bastille_releasesdir}/${RELEASE}/${files}" "${bastille_jail_path}/${files}"; then ## notify and clean stale files/directories bastille destroy "${NAME}" error_exit "Failed to copy release files. Please retry create!" diff --git a/usr/local/share/bastille/pkg.sh b/usr/local/share/bastille/pkg.sh index 989c1906..4df3efc9 100644 --- a/usr/local/share/bastille/pkg.sh +++ b/usr/local/share/bastille/pkg.sh @@ -47,7 +47,7 @@ fi for _jail in ${JAILS}; do info "[${_jail}]:" - if [ -f /usr/sbin/pkg ]; then + if [ -f "/usr/sbin/pkg" ]; then jexec -l "${_jail}" /usr/sbin/pkg "$@" else jexec -l "${_jail}" /usr/sbin/mport "$@" diff --git a/usr/local/share/bastille/update.sh b/usr/local/share/bastille/update.sh index 78a7a80e..bd086303 100644 --- a/usr/local/share/bastille/update.sh +++ b/usr/local/share/bastille/update.sh @@ -64,7 +64,7 @@ if [ "${TARGET}" = "ALL" ]; then error_exit "Batch upgrade is unsupported." fi -if [ -f /bin/midnightbsd-version ]; then +if [ -f "/bin/midnightbsd-version" ]; then echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" exit 1 fi diff --git a/usr/local/share/bastille/upgrade.sh b/usr/local/share/bastille/upgrade.sh index eaa2c1a2..646266f9 100644 --- a/usr/local/share/bastille/upgrade.sh +++ b/usr/local/share/bastille/upgrade.sh @@ -55,7 +55,7 @@ if [ "${TARGET}" = "ALL" ]; then error_exit "Batch upgrade is unsupported." fi -if [ -f /bin/midnightbsd-version ]; then +if [ -f "/bin/midnightbsd-version" ]; then echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" exit 1 fi diff --git a/usr/local/share/bastille/verify.sh b/usr/local/share/bastille/verify.sh index 1246cc00..5af8947c 100644 --- a/usr/local/share/bastille/verify.sh +++ b/usr/local/share/bastille/verify.sh @@ -36,7 +36,7 @@ bastille_usage() { } verify_release() { - if [ -f /bin/midnightbsd-version ]; then + if [ -f "/bin/midnightbsd-version" ]; then echo -e "${COLOR_RED}Not yet supported on MidnightBSD.${COLOR_RESET}" exit 1 fi @@ -69,7 +69,7 @@ verify_template() { echo error_exit "Template validation failed." ## if INCLUDE; recursive verify - elif [ ${_hook} = 'INCLUDE' ]; then + elif [ "${_hook}" = 'INCLUDE' ]; then info "[${_hook}]:" cat "${_path}" echo @@ -92,13 +92,13 @@ verify_template() { done < "${_path}" ## if tree; tree -a bastille_template/_dir - elif [ ${_hook} = 'OVERLAY' ]; then + elif [ "${_hook}" = 'OVERLAY' ]; then info "[${_hook}]:" cat "${_path}" echo while read _dir; do info "[${_hook}]:[${_dir}]:" - if [ -x /usr/local/bin/tree ]; then + if [ -x "/usr/local/bin/tree" ]; then /usr/local/bin/tree -a "${_template_path}/${_dir}" else find "${_template_path}/${_dir}" -print | sed -e 's;[^/]*/;|___;g;s;___|; |;g' @@ -114,7 +114,7 @@ verify_template() { done ## remove bad templates - if [ ${_hook_validate} -lt 1 ]; then + if [ "${_hook_validate}" -lt 1 ]; then error_notify "No valid template hooks found." error_notify "Template discarded." rm -rf "${bastille_template}" @@ -122,7 +122,7 @@ verify_template() { fi ## if validated; ready to use - if [ ${_hook_validate} -gt 0 ]; then + if [ "${_hook_validate}" -gt 0 ]; then info "Template ready to use." fi }