Merge remote-tracking branch 'qubesos/pr/94'

* qubesos/pr/94:
  Drop fakeroot for list/search actions on Debian
  dom0-update: add some approximation of 'list', 'search' and 'reinstall'
  dom0-updates: refactor for ease adding new actions with old yum
This commit is contained in:
Marek Marczykowski-Górecki 2018-02-22 21:29:31 +01:00
commit 8750bf6338
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -108,15 +108,9 @@ YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y --downloadonly"
# check for --downloadonly option - if not supported (Debian), fallback to
# yumdownloader
if ! $YUM --help | grep -q downloadonly; then
if [ "$YUM_ACTION" != "install" ] && [ "$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
if [ "$YUM_ACTION" = "install" ]; then
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
elif [ "$YUM_ACTION" = "upgrade" ]; then
# shellcheck disable=SC2086
UPDATES_FULL=$($YUM $OPTS check-update $PKGLIST)
check_update_retcode=$?
@ -128,8 +122,23 @@ if ! $YUM --help | grep -q downloadonly; then
exit 0
fi
PKGLIST=$UPDATES
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
elif [ "$YUM_ACTION" == "list" ] || [ "$YUM_ACTION" == "search" ]; then
# those actions do not download any package, so lack of --downloadonly is irrelevant
YUM_COMMAND="$YUM $YUM_ACTION -y"
elif [ "$YUM_ACTION" == "reinstal" ]; then
# this is just approximation of 'reinstall' action...
# shellcheck disable=SC2086
PKGLIST=$(rpm --root=$DOM0_UPDATES_DIR -q $PKGLIST)
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
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
YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve"
fi
mkdir -p "$DOM0_UPDATES_DIR/packages"