dom0/qvm-dom0-update: Filter yum options in dom0

Eg. don't pass --enablerepo to yum install.
This commit is contained in:
Marek Marczykowski 2011-09-12 16:21:03 +02:00
parent fde8bc35fa
commit 029e3fc098

View File

@ -29,8 +29,26 @@ qvm-run -a $UPDATEVM true || exit 1
qvm-run --pass_io $UPDATEVM "/usr/lib/qubes/qubes_download_dom0_updates.sh --doit --nogui $*" || exit 1
# Wait for download completed
while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done
if [ $# -gt 0 ]; then
PKGS=
OPTS=
# Filter out some yum options and collect packages list
while [ $# -gt 0 ]; do
case "$1" in
--enablerepo=*|\
--disablerepo=*|\
--clean)
;;
-*)
OPTS="$OPTS $1"
;;
*)
PKGS="$PKGS $1"
;;
esac
shift
done
if [ "x$PKGS" != "x" ]; then
ID=$(id -ur)
if [ $ID != 0 ] ; then
echo "This script should be run as root, use sudo next time."
@ -38,7 +56,7 @@ if [ $# -gt 0 ]; then
exit
fi
yum install $@
yum $OPTS install $PKGS
elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
# Above file exists only when at least one package was downloaded
yum check-update
@ -50,7 +68,7 @@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
echo "Now you can manually run yum update (use sudo again)."
exit
fi
yum update
yum $OPTS update
fi
else
echo "No updates avaliable"