Feature to disable output colors

This commit is contained in:
JRGTH
2021-07-13 04:49:25 -04:00
parent b1258378ab
commit 50c09d0359
5 changed files with 21 additions and 4 deletions

View File

@@ -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/"

View File

@@ -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() {

View File

@@ -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:

View File

@@ -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:

View File

@@ -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: