Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src/apply.bash: Fix optional sys upgrade #210

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading