Add envvar to disable logging

In case shit gets spammy or whatever
This commit is contained in:
Salt 2019-06-21 08:16:12 -05:00
parent 3d5fde695a
commit adae474436

View File

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