Skip to content

Commit

Permalink
dom0-updates: force refreshing sqlite rpmdb if legacy one is newer
Browse files Browse the repository at this point in the history
This is especially relevant for older dom0 (in R4.1) - otherwise once
converted rpmdb won't be updated in subsequent calls. But add it to
newer systems too, in case similar logic will be necessary in the future
too.

Fixes: e7aed41 "Handle dom0 rpmdb in /usr/lib/sysimage/rpm too"
QubesOS/qubes-issues#6982

(cherry picked from commit b26f5ce)
  • Loading branch information
marmarek committed Mar 12, 2023
1 parent 1c1f0c8 commit 4709430
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions package-managers/qubes-download-dom0-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ fi

mkdir -p $DOM0_UPDATES_DIR/etc

# remove converted sqlite db if legacy db is newer, to force conversion again
# legacy db could be only in the /var/lib/rpm location, but sqlite could be in any
if [ "$DOM0_UPDATES_DIR/var/lib/rpm/Packages" -nt "$DOM0_UPDATES_DIR/var/lib/rpm/rpmdb.sqlite" ]; then
rm -f -- "$DOM0_UPDATES_DIR/var/lib/rpm/rpmdb.sqlite"*
elif [ "$DOM0_UPDATES_DIR/var/lib/rpm/Packages" -nt "$DOM0_UPDATES_DIR/usr/lib/sysimage/rpm/rpmdb.sqlite" ]; then
# remove the whole directory, to make the logic below happy
rm -rf -- "$DOM0_UPDATES_DIR/usr/lib/sysimage/rpm"
fi

# Check if we need to copy rpmdb somewhere else
DOM0_DBPATH=/var/lib/rpm
if [ -d "$DOM0_UPDATES_DIR/usr/lib/sysimage/rpm" ] && ! [ -L "$DOM0_UPDATES_DIR/usr/lib/sysimage/rpm" ]; then
Expand Down

0 comments on commit 4709430

Please sign in to comment.