From 53482fb9e640126cd2a7779ba39502c38c845d36 Mon Sep 17 00:00:00 2001 From: binomnom <52407272+binomnom@users.noreply.github.com> Date: Sat, 5 Sep 2026 21:50:20 +0200 Subject: [PATCH 1/2] fix: make setstatus() accept label as first argument fixes #88 --- lib/geoip-shell-lib-config.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/geoip-shell-lib-config.sh b/lib/geoip-shell-lib-config.sh index 79cee78..eb9df4e 100644 --- a/lib/geoip-shell-lib-config.sh +++ b/lib/geoip-shell-lib-config.sh @@ -469,16 +469,17 @@ getstatus() { } # wrapper for setconfig() -# 1: path to file +# 1: section label +# 2: path to file # args are passed as is to setconfig setstatus() { - [ "$1" ] || { bad_args setstatus "$@"; die; } - [ -d "${1%/*}" ] || mkdir -p "${1%/*}" || return 1 - # [ "$ROOT_OK" = 1 ] && chmod -R 600 "${1%/*}" - # [ -f "$1" ] || touch "$1" && - # [ "$ROOT_OK" = 1 ] && chmod 600 "$1" + [ "$1" ] && [ "$2" ] || { bad_args setstatus "$@"; die; } + [ -d "${2%/*}" ] || mkdir -p "${2%/*}" || return 1 + # [ "$ROOT_OK" = 1 ] && chmod -R 600 "${2%/*}" + # [ -f "$2" ] || touch "$2" && + # [ "$ROOT_OK" = 1 ] && chmod 600 "$2" setconfig "$@" && return 0 - rm -f "$1" + rm -f "$2" return 1 } From 2c57e56cab63993c86d69f399f9f8d405648ab65 Mon Sep 17 00:00:00 2001 From: binomnom <52407272+binomnom@users.noreply.github.com> Date: Mon, 7 Sep 2026 15:44:42 +0200 Subject: [PATCH 2/2] Update setstatus comment to match nomenclature. resolves https://github.com/friendly-bits/geoip-shell/pull/89#discussion_r3950156152 --- lib/geoip-shell-lib-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/geoip-shell-lib-config.sh b/lib/geoip-shell-lib-config.sh index eb9df4e..863da98 100644 --- a/lib/geoip-shell-lib-config.sh +++ b/lib/geoip-shell-lib-config.sh @@ -469,7 +469,7 @@ getstatus() { } # wrapper for setconfig() -# 1: section label +# 1: type # 2: path to file # args are passed as is to setconfig setstatus() {