dom0-updates: refactor for ease adding new actions with old yum
Some more actions could be implemented even without --downloadonly option. Ease doing so. QubesOS/qubes-issues#3553
This commit is contained in:
parent
c6cdbf87b0
commit
0b7f1fa905
@ -108,15 +108,9 @@ 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
|
||||||
if [ "$YUM_ACTION" != "install" ] && [ "$YUM_ACTION" != "upgrade" ]; then
|
if [ "$YUM_ACTION" = "install" ]; then
|
||||||
echo "ERROR: yum version installed in VM $(hostname) does not suppport --downloadonly option" >&2
|
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
|
||||||
echo "ERROR: only 'install' and 'upgrade' actions supported ($YUM_ACTION not)" >&2
|
elif [ "$YUM_ACTION" = "upgrade" ]; then
|
||||||
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
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
UPDATES_FULL=$($YUM $OPTS check-update $PKGLIST)
|
UPDATES_FULL=$($YUM $OPTS check-update $PKGLIST)
|
||||||
check_update_retcode=$?
|
check_update_retcode=$?
|
||||||
@ -128,8 +122,14 @@ if ! $YUM --help | grep -q downloadonly; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
PKGLIST=$UPDATES
|
PKGLIST=$UPDATES
|
||||||
|
else
|
||||||
|
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
|
fi
|
||||||
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$DOM0_UPDATES_DIR/packages"
|
mkdir -p "$DOM0_UPDATES_DIR/packages"
|
||||||
|
Loading…
Reference in New Issue
Block a user