From ddff440b4fc57ab069f48df11d9910cde333386b Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 19 Dec 2019 11:23:46 -0400 Subject: [PATCH] Simplify grep search, add full path to jexec --- usr/local/share/bastille/update.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/local/share/bastille/update.sh b/usr/local/share/bastille/update.sh index ba8923c..5a46657 100644 --- a/usr/local/share/bastille/update.sh +++ b/usr/local/share/bastille/update.sh @@ -32,7 +32,7 @@ . /usr/local/etc/bastille/bastille.conf usage() { - echo -e "${COLOR_RED}Usage: bastille update release.${COLOR_RESET}" + echo -e "${COLOR_RED}Usage: bastille update release | container.${COLOR_RESET}" exit 1 } @@ -55,11 +55,11 @@ if [ ! -z "$(freebsd-version | grep -i HBSD)" ]; then exit 1 fi -if [ -d "${bastille_jailsdir}/${TARGET}" ]; then - if ! cat "${bastille_jailsdir}/${TARGET}/fstab" 2>/dev/null | grep -w "${TARGET}" | grep -q ".bastille"; then +if [ -d "${bastille_jailsdir}/${TARGET}" ]; then + if ! grep -qw ".bastille" "${bastille_jailsdir}/${TARGET}/fstab"; then if [ "$(jls name | grep -w "${TARGET}")" ]; then # Update a thick container. - CURRENT_VERSION=$(jexec -l ${TARGET} freebsd-version 2>/dev/null) + CURRENT_VERSION=$(/usr/sbin/jexec -l ${TARGET} freebsd-version 2>/dev/null) if [ -z "${CURRENT_VERSION}" ]; then echo -e "${COLOR_RED}Can't determine '${TARGET}' version.${COLOR_RESET}" exit 1