Merge pull request #85 from JRGTH/master
Improved container update process, add support for Thickjail updates
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
. /usr/local/etc/bastille/bastille.conf
|
. /usr/local/etc/bastille/bastille.conf
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo -e "${COLOR_RED}Usage: bastille update release.${COLOR_RESET}"
|
echo -e "${COLOR_RED}Usage: bastille update release | container.${COLOR_RESET}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ if [ $# -gt 1 ] || [ $# -lt 1 ]; then
|
|||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RELEASE="${1}"
|
TARGET="${1}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [ ! -z "$(freebsd-version | grep -i HBSD)" ]; then
|
if [ ! -z "$(freebsd-version | grep -i HBSD)" ]; then
|
||||||
@@ -55,9 +55,34 @@ if [ ! -z "$(freebsd-version | grep -i HBSD)" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "${bastille_releasesdir}/${RELEASE}" ]; then
|
if [ -d "${bastille_jailsdir}/${TARGET}" ]; then
|
||||||
freebsd-update -b "${bastille_releasesdir}/${RELEASE}" fetch install --currently-running "${RELEASE}"
|
if ! grep -qw ".bastille" "${bastille_jailsdir}/${TARGET}/fstab"; then
|
||||||
|
if [ "$(jls name | grep -w "${TARGET}")" ]; then
|
||||||
|
# Update a thick container.
|
||||||
|
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
|
||||||
|
else
|
||||||
|
env PAGER="/bin/cat" freebsd-update --not-running-from-cron -b "${bastille_jailsdir}/${TARGET}/root" \
|
||||||
|
fetch install --currently-running "${CURRENT_VERSION}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${COLOR_RED}${TARGET} is not running.${COLOR_RESET}"
|
||||||
|
echo -e "${COLOR_RED}See 'bastille start ${TARGET}'.${COLOR_RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "${COLOR_RED}${TARGET} is not a thick container.${COLOR_RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${COLOR_RED}${RELEASE} not found. See bootstrap.${COLOR_RESET}"
|
if [ -d "${bastille_releasesdir}/${TARGET}" ]; then
|
||||||
exit 1
|
# Update container base(affects child containers).
|
||||||
|
env PAGER="/bin/cat" freebsd-update --not-running-from-cron -b "${bastille_releasesdir}/${TARGET}" \
|
||||||
|
fetch install --currently-running "${TARGET}"
|
||||||
|
else
|
||||||
|
echo -e "${COLOR_RED}${TARGET} not found. See bootstrap.${COLOR_RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user