From adae47443666b51dcbac43ec580aefc94db30bab Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 21 Jun 2019 08:16:12 -0500 Subject: [PATCH] Add envvar to disable logging In case shit gets spammy or whatever --- firestarter | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/firestarter b/firestarter index eeff9a4..ad4c7d5 100755 --- a/firestarter +++ b/firestarter @@ -259,6 +259,10 @@ Start or generate a desktop environment configuration -d Perform a dry run. This will print the results of all decisions without executing them. +Additionally, firestarter responds to the following environment variables: + + FS_NOLOG If nonempty, create no log files + Copyright (c) 2019 rehashedsalt@cock.li Licensed under the MIT License https://gitlab.com/rehashedsalt/firestarter @@ -343,7 +347,9 @@ step_execute() { err "Failed to create configuration directory \"$g_configdir\"" 52 fi fi - if ! [ -d "$g_logdir" ]; then + if [ -n "$FS_NOLOG" ]; then + log "No logs will be created per FS_NOLOG" + elif ! [ -d "$g_logdir" ]; then if ! mkdir -p "$g_logdir" > /dev/null 2>&1; then err "Failed to create log directory \"$g_logdir\"" 53 fi @@ -366,8 +372,9 @@ step_execute() { step_execute break fi - filename="$(basename -- "$file")" - logfile="$g_logdir/$filename" + local filename="$(basename -- "$file")" + local logfile="$g_logdir/$filename" + [ -n "$FS_NOLOG" ] && logfile="/dev/null" # Every odd line is the check line # Every even one is the exec line while read -r checkline; do