Add configuration defaults

Don't depend on update.cfg being there.

Move existing hard-coded config to example config.
This commit is contained in:
Dan Church 2022-08-11 12:43:49 -05:00
parent 00b114c85a
commit b77bcfdb89
Signed by: h3xx
GPG key ID: EA2BF379CD2CDBD0
2 changed files with 16 additions and 7 deletions

View file

@ -1,10 +1,11 @@
# vi: ft=sh
WORKDIR=${WORKDIR:-${BASH_SOURCE%/*}}
BACKUPSUFFIX=.old
BLOCKLIST=$WORKDIR/block.list
LIST_DIR=$WORKDIR/lists
OUT=()
URL=()
# Defaults:
#WORKDIR=${WORKDIR:-${BASH_SOURCE%/*}}
#BACKUPSUFFIX=
#BLOCKLIST=$WORKDIR/block.list
#LIST_DIR=$WORKDIR/lists
#OUT=()
#URL=()
# Individual hosts lists in that collection
#OUT+=("$LIST_DIR/sb-Badd-Boyz-Hosts.hosts")

View file

@ -6,7 +6,15 @@ set -e
WORKDIR=${0%/*}
CFG=$WORKDIR/update.cfg
. "$CFG"
# Config defaults
BACKUPSUFFIX=
BLOCKLIST=$WORKDIR/block.list
LIST_DIR=$WORKDIR/lists
OUT=()
URL=()
if [[ -f $CFG ]]; then
. "$CFG"
fi
TEMP_DIR=$(mktemp -d -t "${0##*/}.XXXXXX")
cleanup() {