Refactor qubes.InstallUpdatesGUI to reduce code duplication

QubesOS/qubes-issues#2431
This commit is contained in:
Marek Marczykowski-Górecki 2016-11-12 22:21:42 +01:00
parent 0fb3e503d3
commit 7fa4115aba
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -5,15 +5,17 @@
# with distribution-specific script.
if [ -e /etc/redhat-release -a -x /usr/bin/dnf ]; then
xterm -title update -e su -l -c 'dnf update --best; echo Done. Press Enter to exit.; read x'
update_cmd='dnf update --best'
elif [ -e /etc/redhat-release -a -x /usr/bin/yum ]; then
xterm -title update -e su -l -c 'yum update; echo Done. Press Enter to exit.; read x'
update_cmd='yum update'
elif [ -e /etc/debian_version ]; then
xterm -title update -e su -l -c 'apt-get update && apt-get -V dist-upgrade; echo Done. Press Enter to exit.; read x'
update_cmd='apt-get update && apt-get -V dist-upgrade'
elif [ -e /etc/arch-release ]; then
xterm -title update -e su -l -c 'pacman -Suy; echo Done. Press Enter to exit.; read x'
update_cmd='pacman -Suy'
else
xterm -title update -e su -l -c 'echo Unsupported distribution, install updates manually; bash -i'
update_cmd='echo Unsupported distribution, install updates manually; bash -i'
fi
xterm -title update -e su -l -c "$update_cmd; echo Done. Press Enter to exit.; read x"
# Notify dom0 about installed updates
su -c 'service qubes-update-check start'