Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/packages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlen Huang <i@glenhuang.com>2022-11-11 14:16:53 +0300
committerGlen Huang <i@glenhuang.com>2022-11-11 14:19:02 +0300
commit8edcd33fb731025159c218e960546e43e9fed0e0 (patch)
tree3ed40271e1ea3ddaf14ca39b5ee51d491d8b362f
parentc33c2d886918cfbc1af8d60cbb530ba563084b67 (diff)
acme: simplify flock usage
Signed-off-by: Glen Huang <i@glenhuang.com>
-rw-r--r--net/acme-common/files/acme.sh28
1 files changed, 12 insertions, 16 deletions
diff --git a/net/acme-common/files/acme.sh b/net/acme-common/files/acme.sh
index bcf3d8451..582575f89 100644
--- a/net/acme-common/files/acme.sh
+++ b/net/acme-common/files/acme.sh
@@ -117,15 +117,6 @@ load_globals() {
return 1
}
-cmd_get() {
- trap cleanup EXIT
-
- config_load acme
- config_foreach load_globals acme
-
- config_foreach get_cert cert
-}
-
usage() {
cat <<EOF
Usage: acme <command> [arguments]
@@ -143,13 +134,18 @@ fi
case $1 in
get)
mkdir -p $run_dir
- {
- if ! flock -n 200; then
- log err "Another ACME instance is already running."
- exit 1
- fi
- cmd_get "$@"
- } 200>$run_dir/lock
+ exec 200>$run_dir/lock
+ if ! flock -n 200; then
+ log err "Another ACME instance is already running."
+ exit 1
+ fi
+
+ trap cleanup EXIT
+
+ config_load acme
+ config_foreach load_globals acme
+
+ config_foreach get_cert cert
;;
*)
usage