From b77bcfdb89d5d903a04c7f98a1f171984f4146df Mon Sep 17 00:00:00 2001 From: Dan Church Date: Thu, 11 Aug 2022 12:43:49 -0500 Subject: [PATCH] Add configuration defaults Don't depend on update.cfg being there. Move existing hard-coded config to example config. --- update.cfg => update.cfg.example | 13 +++++++------ update.sh | 10 +++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) rename update.cfg => update.cfg.example (70%) diff --git a/update.cfg b/update.cfg.example similarity index 70% rename from update.cfg rename to update.cfg.example index fbd3bc8..522bcb2 100644 --- a/update.cfg +++ b/update.cfg.example @@ -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") diff --git a/update.sh b/update.sh index 19e531b..e1a62bf 100755 --- a/update.sh +++ b/update.sh @@ -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() {