Skip to content

Commit

Permalink
Merge pull request #210 from AleksanderBobinski/bugfix/stale_database…
Browse files Browse the repository at this point in the history
…_fixup

src/apply.bash: Fix optional sys upgrade
  • Loading branch information
CyberShadow authored Nov 14, 2024
2 parents 788860a + 3344156 commit 5014d5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/apply.bash
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ function AconfApply() {

LogLeave # Installing priority files

if LC_ALL=C "$PACMAN" 2>&1 | grep --extended-regexp --only-matching 'database file for [a-z]+ does not exist'
if (LC_ALL=C "$PACMAN" 2>&1 || true) | grep --extended-regexp --only-matching 'database file for .+ does not exist'
then
Log 'The pacman local package database is internally inconsistent. Perform a full refresh and system upgrade now?\n'
Confirm ''

LogEnter 'Performing a full refresh and system upgrade...\n'
sudo "$PACMAN" --sync --refresh --sysupgrade
sudo "$PACMAN" --sync --refresh --sysupgrade --noconfirm
LogLeave
fi

Expand Down
3 changes: 2 additions & 1 deletion test/t/t-2_apply-1_missing_pacman_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ TestIntegrationOnly
# Test recovery from missing pacman databases.

TestPhase_Setup ###############################################################
command sudo rm -rf /var/lib/pacman/sync
TestCreatePackage test-package native
TestAddConfig AddPackage test-package
command sudo rm -rf /var/lib/pacman/sync

TestPhase_Run #################################################################
AconfApply

TestPhase_Check ###############################################################
TestExpectPacManLog <<EOF
--sync --refresh --sysupgrade --noconfirm
--sync test-package
EOF

Expand Down

0 comments on commit 5014d5d

Please sign in to comment.