dom0-update: allow to specify custom yum action
This can be useful for actions like "downgrade", "reinstall" etc. Needs additional testing if whole distribution upgrade using "distro-sync" action will work as expected.
This commit is contained in:
parent
51c736a92c
commit
3c151ca509
@ -16,6 +16,7 @@ if [ "$1" = "--help" ]; then
|
|||||||
echo " --clean clean yum cache before doing anything"
|
echo " --clean clean yum cache before doing anything"
|
||||||
echo " --check-only only check for updates (no install)"
|
echo " --check-only only check for updates (no install)"
|
||||||
echo " --gui use gpk-update-viewer for update selection"
|
echo " --gui use gpk-update-viewer for update selection"
|
||||||
|
echo " --action=... use specific yum action, instead of automatic install/update"
|
||||||
echo " <pkg list> download (and install if run by root) new packages"
|
echo " <pkg list> download (and install if run by root) new packages"
|
||||||
echo " in dom0 instead of updating"
|
echo " in dom0 instead of updating"
|
||||||
exit
|
exit
|
||||||
@ -26,6 +27,7 @@ YUM_OPTS=
|
|||||||
GUI=
|
GUI=
|
||||||
CHECK_ONLY=
|
CHECK_ONLY=
|
||||||
ALL_OPTS=$*
|
ALL_OPTS=$*
|
||||||
|
YUM_ACTION=
|
||||||
QVMRUN_OPTS=
|
QVMRUN_OPTS=
|
||||||
CLEAN=
|
CLEAN=
|
||||||
# Filter out some yum options and collect packages list
|
# Filter out some yum options and collect packages list
|
||||||
@ -43,11 +45,17 @@ while [ $# -gt 0 ]; do
|
|||||||
--check-only)
|
--check-only)
|
||||||
CHECK_ONLY=1
|
CHECK_ONLY=1
|
||||||
;;
|
;;
|
||||||
|
--action=*)
|
||||||
|
YUM_ACTION=${1#--action=}
|
||||||
|
;;
|
||||||
-*)
|
-*)
|
||||||
YUM_OPTS="$YUM_OPTS $1"
|
YUM_OPTS="$YUM_OPTS $1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
PKGS="$PKGS $1"
|
PKGS="$PKGS $1"
|
||||||
|
if [ -z "$YUM_ACTION" ]; then
|
||||||
|
YUM_ACTION=install
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@ -139,8 +147,12 @@ if [ -r /var/lib/qubes/updates/errors ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$YUM_ACTION" ]; then
|
||||||
|
YUM_ACTION=upgrade
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "x$PKGS" != "x" ]; then
|
if [ "x$PKGS" != "x" ]; then
|
||||||
yum $YUM_OPTS install $PKGS
|
yum $YUM_OPTS $YUM_ACTION $PKGS
|
||||||
elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
|
elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
|
||||||
# Above file exists only when at least one package was downloaded
|
# Above file exists only when at least one package was downloaded
|
||||||
if [ "$GUI" == "1" ]; then
|
if [ "$GUI" == "1" ]; then
|
||||||
@ -148,7 +160,7 @@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
|
|||||||
else
|
else
|
||||||
yum check-update
|
yum check-update
|
||||||
if [ $? -eq 100 ]; then
|
if [ $? -eq 100 ]; then
|
||||||
yum $YUM_OPTS update
|
yum $YUM_OPTS $YUM_ACTION
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
yum -q check-update && rm -f $UPDATES_STAT_FILE
|
yum -q check-update && rm -f $UPDATES_STAT_FILE
|
||||||
|
Loading…
Reference in New Issue
Block a user