Merge remote-tracking branch 'origin/pr/39'
* origin/pr/39: misc/upgrades-installed-check: handle apt-get errors fixed inverted logic issue in upgrades-installed-check Improved upgrade notifications sent to QVMM. Fixes QubesOS/qubes-issues#1066
This commit is contained in:
commit
b569f93d0c
3
Makefile
3
Makefile
@ -171,6 +171,9 @@ install-common:
|
||||
install misc/dispvm-prerun.sh $(DESTDIR)$(LIBDIR)/qubes/dispvm-prerun.sh
|
||||
install misc/close-window $(DESTDIR)$(LIBDIR)/qubes/close-window
|
||||
|
||||
install misc/upgrades-installed-check $(DESTDIR)$(LIBDIR)/qubes/upgrades-installed-check
|
||||
install misc/upgrades-status-notify $(DESTDIR)$(LIBDIR)/qubes/upgrades-status-notify
|
||||
|
||||
install -m 0644 network/udev-qubes-network.rules $(DESTDIR)/etc/udev/rules.d/99-qubes-network.rules
|
||||
install network/qubes-setup-dnat-to-ns $(DESTDIR)$(LIBDIR)/qubes
|
||||
install network/setup-ip $(DESTDIR)$(LIBDIR)/qubes/
|
||||
|
25
misc/upgrades-installed-check
Executable file
25
misc/upgrades-installed-check
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
## `echo`s:
|
||||
## * 'true' - if all upgrades have been installed
|
||||
## * 'false' - if there are pending upgrades
|
||||
## * nothing - if apt-get is currently locked
|
||||
##
|
||||
## Forwards the exit code of the package manager.
|
||||
|
||||
if [ -e /etc/system-release ]; then
|
||||
## Fedora
|
||||
yum_output="$(yum -q check-update 2>&1)"
|
||||
exit_code="$?"
|
||||
[ "$exit_code" -eq 100 ] && echo "false" && exit 0
|
||||
[ "$exit_code" -eq 0 ] && echo "true"
|
||||
else
|
||||
## Debian
|
||||
set -e
|
||||
set -o pipefail
|
||||
apt_get_output="$(LANG="C" apt-get -s upgrade 2>&1)"
|
||||
exit_code="$?"
|
||||
echo "$apt_get_output" | awk "/^Inst/{ print $2 }" | [ "$(wc -L)" -eq 0 ] && echo "true" || echo "false"
|
||||
fi
|
||||
|
||||
exit "$exit_code"
|
11
misc/upgrades-status-notify
Executable file
11
misc/upgrades-status-notify
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
upgrades_installed="$(/usr/lib/qubes/upgrades-installed-check 2>&1)"
|
||||
|
||||
if [ "$upgrades_installed" = "true" ]; then
|
||||
/usr/lib/qubes/qrexec-client-vm dom0 qubes.NotifyUpdates /bin/sh -c 'echo 0'
|
||||
elif [ "$upgrades_installed" = "false" ]; then
|
||||
/usr/lib/qubes/qrexec-client-vm dom0 qubes.NotifyUpdates /bin/sh -c 'echo 1'
|
||||
fi
|
@ -1 +1 @@
|
||||
DPkg::Post-Invoke {"/usr/lib/qubes/qrexec-client-vm dom0 qubes.NotifyUpdates /bin/sh -c 'echo 0' || true";};
|
||||
DPkg::Post-Invoke {"/usr/lib/qubes/upgrades-status-notify || true";};
|
||||
|
Loading…
Reference in New Issue
Block a user