diff --git a/usr/local/etc/bastille/bastille.conf.sample b/usr/local/etc/bastille/bastille.conf.sample index c618ef3..67f2f84 100644 --- a/usr/local/etc/bastille/bastille.conf.sample +++ b/usr/local/etc/bastille/bastille.conf.sample @@ -30,6 +30,9 @@ bastille_tzdata="Etc/UTC" ## default ## default jail resolv.conf bastille_resolv_conf="/etc/resolv.conf" ## default: "/etc/resolv.conf" +## default output colors +bastille_colors_enable="YES" ## default: "YES" + ## bootstrap urls bastille_url_freebsd="http://ftp.freebsd.org/pub/FreeBSD/releases/" ## default: "http://ftp.freebsd.org/pub/FreeBSD/releases/" bastille_url_hardenedbsd="http://installer.hardenedbsd.org/pub/hardenedbsd/" ## default: "https://installer.hardenedbsd.org/pub/HardenedBSD/releases/" diff --git a/usr/local/share/bastille/common.sh b/usr/local/share/bastille/common.sh index 5feeb24..4186519 100644 --- a/usr/local/share/bastille/common.sh +++ b/usr/local/share/bastille/common.sh @@ -28,7 +28,21 @@ # 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. -. /usr/local/share/bastille/colors.pre.sh +. /usr/local/etc/bastille/bastille.conf + +# Load text output colors if enabled in config +# else reset colors variables used by bastille +case "${bastille_colors_enable}" in + [Yy][Ee][Ss]) + . /usr/local/share/bastille/colors.pre.sh + ;; + *) + COLOR_RED= + COLOR_GREEN= + COLOR_YELLOW= + COLOR_RESET= + ;; +esac # Notify message on error, but do not exit error_notify() { diff --git a/usr/local/share/bastille/create.sh b/usr/local/share/bastille/create.sh index 560e58e..9acf134 100644 --- a/usr/local/share/bastille/create.sh +++ b/usr/local/share/bastille/create.sh @@ -34,7 +34,7 @@ usage() { # Build an independent usage for the create command # If no option specified, will create a thin container by default - echo -e "${COLOR_RED}Usage: bastille create [option(s)] name release ip [interface]${COLOR_RESET}" + error_notify "Usage: bastille create [option(s)] name release ip [interface]" cat << EOF Options: diff --git a/usr/local/share/bastille/export.sh b/usr/local/share/bastille/export.sh index af1d284..057906c 100644 --- a/usr/local/share/bastille/export.sh +++ b/usr/local/share/bastille/export.sh @@ -36,7 +36,7 @@ usage() { # Valid compress/options for ZFS systems are raw, .gz, .tgz, .txz and .xz # Valid compress/options for non ZFS configured systems are .tgz and .txz # If no compression option specified, user must redirect standard output - echo -e "${COLOR_RED}Usage: bastille export | option(s) | TARGET | PATH${COLOR_RESET}" + error_notify "Usage: bastille export | option(s) | TARGET | PATH" cat << EOF Options: diff --git a/usr/local/share/bastille/import.sh b/usr/local/share/bastille/import.sh index 48e88df..f4c78ce 100644 --- a/usr/local/share/bastille/import.sh +++ b/usr/local/share/bastille/import.sh @@ -34,7 +34,7 @@ usage() { # Build an independent usage for the import command # If no file/extension specified, will import from standard input - echo -e "${COLOR_RED}Usage: bastille import [option(s)] FILE${COLOR_RESET}" + error_notify "Usage: bastille import [option(s)] FILE" cat << EOF Options: