configurehood: Prevent multiple instances at the same time

This is based on a similar patch from Tim Niemeyer.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Reviewed-by: Robert Langhammer <rlanghammer@web.de>
Reviewed-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Adrian Schmutzler 2018-10-31 17:35:27 +01:00
parent 2f7e8a18d8
commit e5d3335c72
2 changed files with 9 additions and 1 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-hoods
PKG_VERSION:=3
PKG_VERSION:=4
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -1,5 +1,13 @@
#!/bin/sh
# Allow only one instance
lockfile="/var/lock/${0##*/}.lock"
if ! lock -n "$lockfile"; then
echo "Only one instance of $0 allowed."
exit 1
fi
trap "lock -u \"$lockfile\"" INT TERM EXIT
. /usr/share/libubox/jshn.sh
. /lib/functions/fff/keyxchange
. /lib/functions/fff/network