dom0-updates: make the tool working on Debian

Restore support for older yum: no --downloadonly option, so use
yumdownloader.
Also add some a code to handle some Debian quirks - especially default
rpmdb location in user home...
This commit is contained in:
Marek Marczykowski-Górecki 2015-06-16 02:22:42 +02:00
parent cdebf33cf6
commit 3fdb67ac2b
3 changed files with 28 additions and 4 deletions

View File

@ -113,7 +113,7 @@ install-common:
install -D misc/polkit-1-qubes-allow-all.rules $(DESTDIR)/etc/polkit-1/rules.d/00-qubes-allow-all.rules
install -D -m 0644 misc/mime-globs $(DESTDIR)/usr/share/qubes/mime-override/globs
install misc/qubes-download-dom0-updates.sh $(DESTDIR)$(LIBDIR)/qubes/
install -d $(DESTDIR)/var/lib/qubes/dom0-updates
install -g user -m 2775 -d $(DESTDIR)/var/lib/qubes/dom0-updates
if [ -r misc/dispvm-dotfiles.$(DIST).tbz ] ; \
then \

2
debian/control vendored
View File

@ -10,7 +10,7 @@ Vcs-Git: git://git.qubes-os.org/marmarek/core-agent-linux.git
Package: qubes-core-agent
Architecture: any
Depends: qubes-utils (>= 3.0.1), libvchan-xen, xenstore-utils, iptables-persistent, xserver-xorg-video-dummy, xen-utils-common, ethtool, python2.7, python-gi, init-system-helpers, xdg-user-dirs, iptables, net-tools, initscripts, imagemagick, fakeroot, systemd, locales, sudo, dmsetup, psmisc, ncurses-term, xserver-xorg-core, x11-xserver-utils, xinit, ${shlibs:Depends}, ${misc:Depends}
Recommends: tinyproxy, gnome-themes-standard, xsettingsd, gnome-packagekit, chrony, ntpdate, network-manager (>= 0.8.1-1), network-manager-gnome, haveged, libnotify-bin, notify-osd, gnome-terminal, python-nautilus, yum
Recommends: tinyproxy, gnome-themes-standard, xsettingsd, gnome-packagekit, chrony, ntpdate, network-manager (>= 0.8.1-1), network-manager-gnome, haveged, libnotify-bin, notify-osd, gnome-terminal, python-nautilus, yum, yum-utils
Conflicts: qubes-core-agent-linux, firewalld, qubes-core-vm-sysvinit
Description: Qubes core agent
This package includes various daemons necessary for qubes domU support,

View File

@ -57,6 +57,12 @@ fi
mkdir -p $DOM0_UPDATES_DIR/etc
sed -i '/^reposdir\s*=/d' $DOM0_UPDATES_DIR/etc/yum.conf
if [ -e /etc/debian_version ]; then
# Default rpm configuration on Debian uses ~/.rpmdb for rpm database (as
# rpm isn't native package manager there)
mkdir -p "$DOM0_UPDATES_DIR$HOME"
ln -nsf "$DOM0_UPDATES_DIR/var/lib/rpm" "$DOM0_UPDATES_DIR$HOME/.rpmdb"
fi
# Rebuild rpm database in case of different rpm version
rm -f $DOM0_UPDATES_DIR/var/lib/rpm/__*
rpm --root=$DOM0_UPDATES_DIR --rebuilddb
@ -91,17 +97,35 @@ if [ "$DOIT" != "1" -a "$PKGS_FROM_CMDLINE" != "1" ]; then
--text="There are updates for dom0 available, do you want to download them now?" || exit 0
fi
YUM_COMMAND="fakeroot yum $YUM_ACTION -y --downloadonly --downloaddir=$DOM0_UPDATES_DIR/packages"
# check for --downloadonly option - if not supported (Debian), fallback to
# yumdownloader
if ! yum --help | grep -q downloadonly; then
if [ "$YUM_ACTION" != "install" -a "$YUM_ACTION" != "upgrade" ]; then
echo "ERROR: yum version installed in VM $HOSTNAME does not suppport --downloadonly option" >&2
echo "ERROR: only 'install' and 'upgrade' actions supported ($YUM_ACTION not)" >&2
if [ "$GUI" = 1 ]; then
zenity --error --text="yum version too old for '$YUM_ACTION' action, see console for details"
fi
exit 1
fi
if [ "$YUM_ACTION" = "upgrade" ]; then
PKGLIST=$UPDATES
fi
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
fi
mkdir -p "$DOM0_UPDATES_DIR/packages"
set -e
if [ "$GUI" = 1 ]; then
( echo "1"
fakeroot yum $YUM_ACTION -y --downloadonly --downloaddir="$DOM0_UPDATES_DIR/packages" $OPTS $PKGLIST
$YUM_COMMAND $OPTS $PKGLIST
echo 100 ) | zenity --progress --pulsate --auto-close --auto-kill \
--text="Downloading updates for Dom0, please wait..." --title="Qubes Dom0 updates"
else
fakeroot yum $YUM_ACTION -y --downloadonly --downloaddir="$DOM0_UPDATES_DIR/packages" $OPTS $PKGLIST
$YUM_COMMAND $OPTS $PKGLIST
fi
if ls $DOM0_UPDATES_DIR/packages/*.rpm > /dev/null 2>&1; then