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

log stdout/err from updates check on Debian #537

Merged
merged 2 commits into from
Jan 7, 2025
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
2 changes: 1 addition & 1 deletion package-managers/apt-conf-00notify-hook
Original file line number Diff line number Diff line change
@@ -1 +1 @@
DPkg::Post-Invoke {"/usr/lib/qubes/upgrades-status-notify || true";};
DPkg::Post-Invoke {"/usr/lib/qubes/upgrades-status-notify skip-refresh || true";};
15 changes: 13 additions & 2 deletions package-managers/upgrades-installed-check
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
## * 'false' - if there are pending upgrades
## * nothing - if apt-get is currently locked
##
## optional argument "skip-refresh" can be used to not refresh metadata (useful
## when it's already up to date, like after installing updates)
##
## Forwards the exit code of the package manager.

skip_refresh=false
if [ "$1" = "skip-refresh" ]; then
skip_refresh=true
fi

if [ -e /etc/system-release ]; then
## Fedora
if command -v dnf >/dev/null; then
Expand All @@ -23,12 +31,15 @@ elif [ -e /etc/debian_version ]; then
## Debian
set -e
set -o pipefail
# shellcheck disable=SC2034
apt_get_update_output="$(apt-get -q update 2>&1)"
if ! $skip_refresh; then
# shellcheck disable=SC2034
apt_get_update_output="$(apt-get -q update 2>&1 | tee /proc/self/fd/2)"
fi
apt_get_upgrade_output="$(LANG="C" apt-get -s upgrade 2>&1)"
exit_code="$?"
# shellcheck disable=SC2266
echo "$apt_get_upgrade_output" | awk "/^Inst/{ print $2 }" | [ "$(wc -L)" -eq 0 ] && echo "true" || echo "false"
echo "$apt_get_upgrade_output" >&2
elif [ -e /etc/arch-release ]; then
## Archlinux
checkupdates >/dev/null 2>&1
Expand Down
7 changes: 6 additions & 1 deletion package-managers/upgrades-status-notify
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ else
fi
fi

upgrades_installed="$(/usr/lib/qubes/upgrades-installed-check)"
script_arg=
if [ "$1" = "skip-refresh" ]; then
script_arg=skip-refresh
fi

upgrades_installed="$(/usr/lib/qubes/upgrades-installed-check $script_arg)"

if [ "$upgrades_installed" = "true" ]; then
/usr/lib/qubes/qrexec-client-vm dom0 qubes.NotifyUpdates /bin/sh -c 'echo 0'
Expand Down