From 3110ef125518b9f37ffb1681bd6b7b22cbb39a29 Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Sun, 30 Jun 2024 21:51:35 +0330 Subject: [PATCH] qubes-dom0-update: prevent concurrent execution fixes: https://github.com/QubesOS/qubes-issues/issues/6345 --- dom0-updates/qubes-dom0-update | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dom0-updates/qubes-dom0-update b/dom0-updates/qubes-dom0-update index e23455e..3467475 100755 --- a/dom0-updates/qubes-dom0-update +++ b/dom0-updates/qubes-dom0-update @@ -187,6 +187,13 @@ if [ "$ID" != 0 ] && [ -z "$GUI" ] && [ -z "$CHECK_ONLY" ] ; then exit 1 fi +exec 9>"/var/run/qubes/qubes-dom0-update.lock" +flock -n 9 +if [[ ${?} -ne 0 ]]; then + echo "Another instance of qubes-dom0-update is already running!" + exit 1 +fi + if [ "$GUI" == "1" ] && [ ${#PKGS[@]} -ne 0 ]; then echo "ERROR: GUI mode can be used only for updates" >&2 exit 1