fix: hold a setup lock instead of guessing from running processes

This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-26 12:47:00 -04:00
1 parent 2e2b950964
commit c446566f42
2 files changed
+13 -18

No files matched your search

@@ -25,6 +25,7 @@ NEEDS
WORK=/var/cache/droiddeck-flatpak
CONF=$WORK/pacman.conf
mkdir -p "$WORK/pkg" "$WORK/db" || fail "cannot create $WORK"
exec 9>"$WORK/setup.lock" && flock -n 9 || fail "another Flatpak setup is still running"
OVERSEAS="https://ca.us.mirror.archlinuxarm.org https://fl.us.mirror.archlinuxarm.org https://de3.mirror.archlinuxarm.org https://nl.mirror.archlinuxarm.org"
MAINLAND=""
@@ -49,9 +50,7 @@ if [ ! -f /etc/pacman.d/gnupg/pubring.gpg ] && [ ! -f /etc/pacman.d/gnupg/pubrin
fi
step "Reading the package lists"
if [ -e "$WORK/db/db.lck" ] && ! grep -qx pacman /proc/[0-9]*/comm 2>/dev/null; then
rm -f "$WORK/db/db.lck"
fi
rm -f "$WORK/db/db.lck"
sync_log=$(pacman --config "$CONF" --dbpath "$WORK/db" --noconfirm -Sy 2>&1) \
|| sync_log=$(pacman --config "$CONF" --dbpath "$WORK/db" --noconfirm -Sy 2>&1)
if [ ! -f "$WORK/db/sync/extra.db" ]; then