aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorKenneth Johansson <kenneth.johansson@inteno.se>2017-05-24 13:45:37 +0200
committerJohn Crispin <john@phrozen.org>2017-05-25 09:22:43 +0200
commite96a9a9af82c00dcce606a84a7bb87a00411385d (patch)
treef711519effca1b4dd68abc9168c227f4482e6448 /package/base-files
parent8e0e0e7d8bfbe7befcaa453f0b4993605703a690 (diff)
downloadupstream-e96a9a9af82c00dcce606a84a7bb87a00411385d.tar.gz
upstream-e96a9a9af82c00dcce606a84a7bb87a00411385d.tar.bz2
upstream-e96a9a9af82c00dcce606a84a7bb87a00411385d.zip
sysupgrade: run only one instance at a time.
Things do not work well if running multiple instances of upgrade at the same time. Signed-off-by: Kenneth Johansson <kenneth.johansson@inteno.se>
Diffstat (limited to 'package/base-files')
-rwxr-xr-xpackage/base-files/files/sbin/sysupgrade14
1 files changed, 14 insertions, 0 deletions
diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade
index c095ca81c5..1eede14b05 100755
--- a/package/base-files/files/sbin/sysupgrade
+++ b/package/base-files/files/sbin/sysupgrade
@@ -47,6 +47,20 @@ while [ -n "$1" ]; do
shift;
done
+# just one instance
+if ! lock -n /tmp/sysupgrade.lock
+then
+ echo "Another instance of sysupgrade already running"
+ echo "If you are sure this is wrong remove file /tmp/sysupgrade.lock"
+ exit 1
+fi
+
+# make sure the lock is removed when done even when killed
+finish() {
+ lock -u /var/sysupgrade.lock
+}
+trap finish EXIT INT TERM
+
export CONFFILES=/tmp/sysupgrade.conffiles
export CONF_TAR=/tmp/sysupgrade.tgz