dom0-updates: use dnf when available
Since yum-deprecated is slowly removed from Fedora (in Fedora 23 is not installed by default), we're forced to migrate to dnf. The main problem with dnf here is lack of --downloaddir option (https://bugzilla.redhat.com/show_bug.cgi?id=1279001). As nobody is going to implement it, simply extract downloaded packages from cache directory (thanks to provided config file, it is always /var/cache/yum). This basically replaces "dom0-updates: use yum-deprecated instead of dnf in all calls" with a set of workarounds for dnf missing parts. Related to QubesOS/qubes-issues#1574
This commit is contained in:
parent
3db93cdc87
commit
07c442f534
@ -7,6 +7,8 @@ GUI=1
|
|||||||
CLEAN=0
|
CLEAN=0
|
||||||
CHECK_ONLY=0
|
CHECK_ONLY=0
|
||||||
OPTS="--installroot $DOM0_UPDATES_DIR --config=$DOM0_UPDATES_DIR/etc/yum.conf"
|
OPTS="--installroot $DOM0_UPDATES_DIR --config=$DOM0_UPDATES_DIR/etc/yum.conf"
|
||||||
|
# DNF uses /etc/yum.repos.d, even when --installroot is specified
|
||||||
|
OPTS="$OPTS --setopt=reposdir=$DOM0_UPDATES_DIR/etc/yum.repos.d"
|
||||||
PKGLIST=
|
PKGLIST=
|
||||||
YUM_ACTION=
|
YUM_ACTION=
|
||||||
|
|
||||||
@ -50,11 +52,8 @@ if [ -z "$YUM_ACTION" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
YUM="yum"
|
YUM="yum"
|
||||||
# prefer yum-deprecated over dnf, because of still missing features in dnf (at least --downloaddir)
|
if type dnf >/dev/null 2>&1; then
|
||||||
if type dnf >/dev/null 2>&1 && type yum-deprecated >/dev/null 2>&1; then
|
YUM="dnf"
|
||||||
echo "(Note: dnf will complain that the yum command has been deprecated." >&2
|
|
||||||
echo "This message is safe to ignore.)" >&2
|
|
||||||
YUM="yum-deprecated"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -d "$DOM0_UPDATES_DIR" ]; then
|
if ! [ -d "$DOM0_UPDATES_DIR" ]; then
|
||||||
@ -78,6 +77,7 @@ rpm --root=$DOM0_UPDATES_DIR --rebuilddb
|
|||||||
if [ "$CLEAN" = "1" ]; then
|
if [ "$CLEAN" = "1" ]; then
|
||||||
$YUM $OPTS clean all
|
$YUM $OPTS clean all
|
||||||
rm -f $DOM0_UPDATES_DIR/packages/*
|
rm -f $DOM0_UPDATES_DIR/packages/*
|
||||||
|
rm -f $DOM0_UPDATES_DIR/var/cache/yum/*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$PKGLIST" = "x" ]; then
|
if [ "x$PKGLIST" = "x" ]; then
|
||||||
@ -119,7 +119,7 @@ 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
|
--text="There are updates for dom0 available, do you want to download them now?" || exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y --downloadonly --downloaddir=$DOM0_UPDATES_DIR/packages"
|
YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y --downloadonly"
|
||||||
# check for --downloadonly option - if not supported (Debian), fallback to
|
# check for --downloadonly option - if not supported (Debian), fallback to
|
||||||
# yumdownloader
|
# yumdownloader
|
||||||
if ! $YUM --help | grep -q downloadonly; then
|
if ! $YUM --help | grep -q downloadonly; then
|
||||||
@ -150,6 +150,9 @@ else
|
|||||||
$YUM_COMMAND $OPTS $PKGLIST
|
$YUM_COMMAND $OPTS $PKGLIST
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
find $DOM0_UPDATES_DIR/var/cache/yum -name '*.rpm' -print0 |\
|
||||||
|
xargs -0 -r ln -f -t $DOM0_UPDATES_DIR/packages/
|
||||||
|
|
||||||
if ls $DOM0_UPDATES_DIR/packages/*.rpm > /dev/null 2>&1; then
|
if ls $DOM0_UPDATES_DIR/packages/*.rpm > /dev/null 2>&1; then
|
||||||
cmd="/usr/lib/qubes/qrexec-client-vm dom0 qubes.ReceiveUpdates /usr/lib/qubes/qfile-agent"
|
cmd="/usr/lib/qubes/qrexec-client-vm dom0 qubes.ReceiveUpdates /usr/lib/qubes/qfile-agent"
|
||||||
qrexec_exit_code=0
|
qrexec_exit_code=0
|
||||||
|
Loading…
Reference in New Issue
Block a user