Skip to content

Commit

Permalink
Merge pull request #17 from cedwards/master
Browse files Browse the repository at this point in the history
0.3.2018112002 bugfix release
  • Loading branch information
cedwards authored Nov 21, 2018
2 parents 55268d8 + f38eff5 commit 18eec0d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 19 deletions.
6 changes: 1 addition & 5 deletions usr/local/bin/bastille
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

SAVED_TERM=$TERM

. /usr/local/share/bastille/colors.pre.sh
. /usr/local/etc/bastille/bastille.conf

## version
BASTILLE_VERSION="0.3.20181114"

BASTILLE_VERSION="0.3.20181120"

usage() {
cat << EOF
Expand Down Expand Up @@ -103,7 +100,6 @@ bootstrap|update|upgrade)
;;
esac


SCRIPTPATH="${bastille_sharedir}/${CMD}.sh"

: ${UMASK:=022}
Expand Down
2 changes: 2 additions & 0 deletions usr/local/share/bastille/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ create_jail() {
if [ "${RELEASE}" == "11.2-RELEASE" ]; then cp -a "${bastille_releasesdir}/${RELEASE}/usr/tests" "${bastille_jail_path}"; fi

## rc.conf.local & resolv.conf
## cron_flags="-J 60" ## cedwards 20181118
if [ ! -f "${bastille_jail_rc_conf}" ]; then
echo -e "syslogd_flags=\"-ss\"\nsendmail_enable=\"NONE\"" > ${bastille_jail_rc_conf}
echo -e "cron_flags=\"-J 60\"" >> ${bastille_jail_rc_conf}
fi

if [ ! -f "${bastille_jail_resolv_conf}" ]; then
Expand Down
8 changes: 3 additions & 5 deletions usr/local/share/bastille/freebsd_dist_fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# https://pastebin.com/T6eThbKu

DEVICE_SELF_SCAN_ALL=NO
DIALOG_BACKTITLE="BastilleBSD"
DIALOG_TITLE="bootstrap"
[ "$_SCRIPT_SUBR" ] || . /usr/share/bsdconfig/script.subr
usage(){ echo "Usage: ${0##*/} [-r releaseName] [dists ...]" >&2; exit 1; }
while getopts hr: flag; do
Expand All @@ -24,13 +22,13 @@ REL_DIST=/usr/local/bastille/cache/$releaseName
download() # $src to $dest
{
size=$( f_device_get device_media "$1" $PROBE_SIZE )
f_device_get device_media "$1" | dpv -kb "$DIALOG_BACKTITLE" \
-t "$DIALOG_TITLE" -p "Downloading $releaseName" \
f_device_get device_media "$1" | dpv -kb "BastilleBSD" \
-t "bootstrap" -p "Downloading $releaseName" \
-o "$3" "$size:$1"
}
sign() # $file
{
dpv -kb "$DIALOG_BACKTITLE" -t "$DIALOG_TITLE" \
dpv -kb "BastilleBSD" -t "bootstrap" \
-p "Signing $releaseName" -mx "sha256 >&2" \
"$size:${1##*/}" "$1" 2>&1 >&$TERMINAL_STDOUT_PASSTHRU
}
Expand Down
17 changes: 9 additions & 8 deletions usr/local/share/bastille/template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ for _jail in ${JAILS}; do
## pre
if [ -s "${bastille_template}/PRE" ]; then
echo -e "${COLOR_GREEN}Executing PRE-command(s).${COLOR_RESET}"
bastille_templatepre=$(cat "${bastille_template}/PRE")
jexec -l "${_jail}" /bin/sh "${bastille_templatepre}"
jexec -l ${_jail} /bin/sh < "${bastille_template}/PRE"
fi

## config
Expand All @@ -80,12 +79,14 @@ for _jail in ${JAILS}; do
if [ -s "${bastille_template}/FSTAB" ]; then
bastille_templatefstab=$(cat "${bastille_template}/FSTAB")
echo -e "${COLOR_GREEN}Updating fstab.${COLOR_RESET}"
echo -e "${COLOR_GREEN}NOT YET IMPLEMENTED.${COLOR_RESET}"
fi

## pf
if [ -s "${bastille_template}/PF" ]; then
bastille_templatepf=$(cat "${bastille_template}/PF")
echo -e "${COLOR_GREEN}Generating PF profile.${COLOR_RESET}"
echo -e "${COLOR_GREEN}NOT YET IMPLEMENTED.${COLOR_RESET}"
fi

## pkg (bootstrap + pkg)
Expand All @@ -94,23 +95,23 @@ for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}Installing packages.${COLOR_RESET}"
jexec -l ${_jail} env ASSUME_ALWAYS_YES="YES" /usr/sbin/pkg bootstrap
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 -y ${bastille_templatepkg}
jexec -l ${_jail} env ASSUME_ALWAYS_YES="YES" /usr/sbin/pkg install ${bastille_templatepkg}
fi

## sysrc
if [ -s "${bastille_template}/SYSRC" ]; then
bastille_templatesys=$(cat "${bastille_template}/SYSRC")
echo -e "${COLOR_GREEN}Updating services.${COLOR_RESET}"
jexec -l ${_jail} /usr/sbin/sysrc ${bastille_templatesys}
IFS=''
while read _sysrc; do
jexec -l ${_jail} /usr/sbin/sysrc "${_sysrc}"
done < "${bastille_template}/SYSRC"
fi

## cmd
if [ -s "${bastille_template}/CMD" ]; then
bastille_templatecmd=$(cat "${bastille_template}/CMD")
echo -e "${COLOR_GREEN}Executing final command(s).${COLOR_RESET}"
jexec -l ${_jail} ${bastille_templatecmd}
jexec -l ${_jail} /bin/sh < "${bastille_template}/CMD"
fi
echo -e "${COLOR_GREEN}Template Complete.${COLOR_RESET}"
echo
echo
done
2 changes: 1 addition & 1 deletion usr/local/share/bastille/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi

RELEASE=$1

echo -e "${COLOR_RED}Targeting specified release.${COLOR_RESET}"
echo -e "${COLOR_GREEN}Targeting specified release.${COLOR_RESET}"
echo -e "${RELEASE}"
echo
if [ -d "${bastille_releasesdir}/${RELEASE}" ]; then
Expand Down

0 comments on commit 18eec0d

Please sign in to comment.