From 85ca59aea4669ebb9ca46ff62cf2a4248ec61436 Mon Sep 17 00:00:00 2001 From: remph Date: Thu, 10 Oct 2024 18:03:10 +0100 Subject: Init a swob/wob.ini if not present, instead of using a temp file. Also, dwl config.h --- swob.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'swob.sh') diff --git a/swob.sh b/swob.sh index 222c62b..d0a92b6 100755 --- a/swob.sh +++ b/swob.sh @@ -3,7 +3,7 @@ # SPDX-License-Identifier: FSFULLRWD wobfifo=${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/wob -wobini= wobini_istemp= +wobini= readonly wobfifo set -o pipefail -efmu # `set -e' comes after readonly and pipefail, they # aren't vital enough to kill the script for @@ -17,13 +17,16 @@ set_wobini() { done # fallthrough to default: temporary wob.ini(5) standin - echo >&2 "$0: warning: no swob/wob.ini found; defaulting to temporary" - wobini=`mktemp` wobini_istemp=1 + wobini=${XDG_CONFIG_HOME:-~/.config}/swob/wob.ini + echo >&2 "$0: no swob/wob.ini found; writing default to $wobini" + mkdir -p "${wobini%/*}" cat >$wobini <