1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-16 20:33:58 +02:00

Merge pull request #19879 from hgl/acme

acme: simplify flock usage
This commit is contained in:
Toke Høiland-Jørgensen 2022-11-11 14:48:50 +01:00 committed by GitHub
commit 23dd1fac75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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