Skip to content

Commit

Permalink
Merge pull request #8 from cedwards/master
Browse files Browse the repository at this point in the history
0.3.20181114 fix all the things
  • Loading branch information
cedwards authored Nov 14, 2018
2 parents 2533f44 + 8b7fb79 commit ca8dad3
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 25 deletions.
14 changes: 2 additions & 12 deletions usr/local/bin/bastille
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ SAVED_TERM=$TERM
. /usr/local/etc/bastille/bastille.conf

## version
BASTILLE_VERSION="0.3.20181112"
BASTILLE_VERSION="0.3.20181114"


usage() {
Expand Down Expand Up @@ -93,20 +93,10 @@ case "${CMD}" in
cmd|cp|create|destroy|list|pkg|restart|start|stop|sysrc|template|verify)
;;
update|upgrade)
CMD_ENV="${CMD_ENV} PAGER=cat"
;;
console|bootstrap|htop|top)
;;
bootstrap|update|upgrade)
while read envvar envvalue; do
case "${envvar}" in
FETCH_BIND_ADDRESS|FTP_*|ftp_*|HTTP_*|http_*|SSL_|NO_PROXY|no_proxy|MAKEOBJDIRPREFIX)
CMD_ENV="${CMD_ENV} ${envvar}=${envvalue}"
;;
esac
done <<-EOF
$(env | sed -Ee 's,^([^=]*)=(.*),\1 \2,')
EOF
;;
*)
usage
Expand All @@ -121,4 +111,4 @@ umask ${UMASK}

: ${SH:=sh}

exec env -i ${CMD_ENV} ${SH} "${SCRIPTPATH}" "$@"
exec ${SH} "${SCRIPTPATH}" "$@"
10 changes: 5 additions & 5 deletions usr/local/share/bastille/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,22 @@ case "${RELEASE}" in
;;
12.0-BETA1)
bootstrap
echo -e "${COLOR_RED}BETA releases are complete untested.${COLOR_RESET}"
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
;;
12.0-BETA2)
bootstrap
echo -e "${COLOR_RED}BETA releases are complete untested.${COLOR_RESET}"
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
;;
12.0-BETA3)
bootstrap
echo -e "${COLOR_RED}BETA releases are complete untested.${COLOR_RESET}"
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
;;
12.0-BETA4)
bootstrap
echo -e "${COLOR_RED}BETA releases are complete untested.${COLOR_RESET}"
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
;;
*)
echo -e "${COLOR_RED}BETA releases are complete untested.${COLOR_RESET}"
echo -e "${COLOR_RED}BETA releases are completely untested.${COLOR_RESET}"
usage
;;
esac
1 change: 1 addition & 0 deletions usr/local/share/bastille/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jexec -l ${_jail} $2
echo
done
3 changes: 2 additions & 1 deletion usr/local/share/bastille/console.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ fi

for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jexec -l ${_jail} /usr/bin/login -fp root
jexec -l ${_jail} /usr/bin/login -f root
echo
done
2 changes: 1 addition & 1 deletion usr/local/share/bastille/cp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ for _jail in ${JAILS}; do
bastille_jail_path="${bastille_jailsdir}/${_jail}/root"
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
cp -a "$2" "${bastille_jail_path}/$3"
echo -e "${COLOR_RESET}"
echo
done
9 changes: 6 additions & 3 deletions usr/local/share/bastille/freebsd_dist_fetch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/sh
# 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 @@ -21,13 +24,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 "BastilleBSD" \
-t "bootstrap" -p "Downloading $releaseName" \
f_device_get device_media "$1" | dpv -kb "$DIALOG_BACKTITLE" \
-t "$DIALOG_TITLE" -p "Downloading $releaseName" \
-o "$3" "$size:$1"
}
sign() # $file
{
dpv -kb "BastilleBSD" -t "bootstrap" \
dpv -kb "$DIALOG_BACKTITLE" -t "$DIALOG_TITLE" \
-p "Signing $releaseName" -mx "sha256 >&2" \
"$size:${1##*/}" "$1" 2>&1 >&$TERMINAL_STDOUT_PASSTHRU
}
Expand Down
15 changes: 14 additions & 1 deletion usr/local/share/bastille/list.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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

usage() {
echo -e "${COLOR_RED}Usage: bastille list.${COLOR_RESET}"
echo -e "${COLOR_RED}Usage: bastille list [release|template|jail|log].${COLOR_RESET}"
exit 1
}

Expand All @@ -45,6 +46,18 @@ if [ $# -gt 0 ]; then
help|-h|--help)
usage
;;
release|releases)
ls "${bastille_releasesdir}"
;;
template|templates)
ls "${bastille_templatesdir}"
;;
jail|jails)
ls "${bastille_jailsdir}"
;;
log|logs)
ls "${bastille_logsdir}"
;;
*)
usage
;;
Expand Down
1 change: 1 addition & 0 deletions usr/local/share/bastille/pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jexec -l ${_jail} /usr/sbin/pkg $2
echo
done
2 changes: 1 addition & 1 deletion usr/local/share/bastille/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jexec -l ${_jail} /usr/sbin/service $2
echo -e "${COLOR_RESET}"
echo
done
1 change: 1 addition & 0 deletions usr/local/share/bastille/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -c ${_jail}
echo
done

## HUP the firewall
Expand Down
1 change: 1 addition & 0 deletions usr/local/share/bastille/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fi
for _jail in ${JAILS}; do
echo -e "${COLOR_GREEN}[${_jail}]:${COLOR_RESET}"
jail -f "${bastille_jailsdir}/${_jail}/jail.conf" -r ${_jail}
echo
done

## HUP the firewall
Expand Down
2 changes: 1 addition & 1 deletion usr/local/share/bastille/template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ for _jail in ${JAILS}; do
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}" "${bastille_templatepre}"
jexec -l "${_jail}" /bin/sh "${bastille_templatepre}"
fi

## config
Expand Down

0 comments on commit ca8dad3

Please sign in to comment.