Compare commits

..

4 Commits

Author SHA1 Message Date
Christer Edwards
29e98b554f Merge pull request #27 from cedwards/master
bootstrap fix
2019-01-02 20:10:46 -07:00
Christer Edwards
655f8d0fe9 bootstrap fix 2019-01-02 20:08:49 -07:00
Christer Edwards
d35b2cc119 Merge pull request #26 from cedwards/master
0.3.20181202 template targets
2018-12-02 08:27:38 -07:00
Christer Edwards
6a8c2f8e53 0.3.20181202 template targets 2018-12-02 08:23:27 -07:00
3 changed files with 22 additions and 11 deletions

View File

@@ -32,7 +32,7 @@
. /usr/local/etc/bastille/bastille.conf
## version
BASTILLE_VERSION="0.3.20181130"
BASTILLE_VERSION="0.3.20190102"
usage() {
cat << EOF

View File

@@ -165,27 +165,23 @@ bootstrap_template() {
# Filter sane release names
case "${1}" in
10.1-RELEASE|10.2-RELEASE|10.3-RELEASE|10.4-RELEASE)
RELEASE="${1}"
bootstrap_release
echo -e "${COLOR_RED}WARNING: FreeBSD 10.1-RELEASE HAS PASSED ITS END-OF-LIFE DATE.${COLOR_RESET}"
;;
11.0-RELEASE|11.1-RELEASE)
RELEASE="${1}"
bootstrap_release
echo -e "${COLOR_RED}WARNING: FreeBSD 11.0-RELEASE HAS PASSED ITS END-OF-LIFE DATE.${COLOR_RESET}"
;;
11.2-RELEASE)
RELEASE="${1}"
bootstrap_release
;;
12.0-RELEASE)
RELEASE="${1}"
bootstrap_release
;;
12.0-BETA1|12.0-BETA2|12.0-BETA3|12.0-BETA4)
bootstrap_release
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
;;
12.0-RC1|12.0-RC2|12.0-RC3)
bootstrap_release
echo -e "${COLOR_RED}RC releases are completely untested.${COLOR_RESET}"
;;
http?://github.com/*/*)
BASTILLE_TEMPLATE_URL=${1}
BASTILLE_TEMPLATE_USER=$(echo "${1}" | awk -F / '{ print $4 }')

View File

@@ -57,6 +57,7 @@ fi
## global variables
TEMPLATE=$2
bastille_template=${bastille_templatesdir}/${TEMPLATE}
bastille_template_TARGET=${bastille_template}/TARGET
bastille_template_INCLUDE=${bastille_template}/INCLUDE
bastille_template_PRE=${bastille_template}/PRE
bastille_template_CONFIG=${bastille_template}/CONFIG
@@ -72,6 +73,20 @@ for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
## TARGET
if [ -s "${bastille_template_TARGET}" ]; then
if [ $(grep -E "(^|\b)\!${_jail}($|\b)" ${bastille_template_TARGET}) ]; then
echo -e "${COLOR_GREEN}TARGET: !${_jail}.${COLOR_RESET}"
echo
continue
fi
if [ ! $(grep -E "(^|\b)(${_jail}|ALL)($|\b)" ${bastille_template_TARGET}) ]; then
echo -e "${COLOR_GREEN}TARGET: ?${_jail}.${COLOR_RESET}"
echo
continue
fi
fi
## INCLUDE
if [ -s "${bastille_template_INCLUDE}" ]; then
echo -e "${COLOR_GREEN}Detected INCLUDE.${COLOR_RESET}"
@@ -113,8 +128,8 @@ for _jail in ${JAILS}; do
if [ -s "${bastille_template_PKG}" ]; then
echo -e "${COLOR_GREEN}Installing packages.${COLOR_RESET}"
jexec -l "${_jail}" env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg bootstrap
jexec -l "${_jail}" /usr/sbin/pkg audit -F
jexec -l "${_jail}" /usr/sbin/pkg install $(cat ${bastille_template_PKG})
jexec -l "${_jail}" env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg audit -F
jexec -l "${_jail}" env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg install $(cat ${bastille_template_PKG})
fi
## sysrc