dom0+vm: Polishing qvm-dom0-upgrade (#287)

Do not print error message when no package downloaded. Also some more covenient
usage when dowloading new packages (implied --resolve --nogui).
This commit is contained in:
Marek Marczykowski 2011-07-24 21:54:10 +02:00 committed by Joanna Rutkowska
parent 5e95380db9
commit 002fad72c4
2 changed files with 24 additions and 8 deletions

View File

@ -28,6 +28,8 @@ PKGLIST="$*"
if [ "x$PKGLIST" = "x" ]; then if [ "x$PKGLIST" = "x" ]; then
echo "Checking for dom0 updates..." echo "Checking for dom0 updates..."
PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '` PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '`
else
PKGS_FROM_CMDLINE=1
fi fi
if [ -z "$PKGLIST" ]; then if [ -z "$PKGLIST" ]; then
@ -35,23 +37,32 @@ if [ -z "$PKGLIST" ]; then
exit 0 exit 0
fi fi
if [ "$DOIT" != "1" ]; then if [ "$DOIT" != "1" -a "$PKGS_FROM_CMDLINE" != "1" ]; then
PKGCOUNT=`echo $PKGLIST|wc -w` PKGCOUNT=`echo $PKGLIST|wc -w`
zenity --question --title="Qubes Dom0 updates" \ zenity --question --title="Qubes Dom0 updates" \
--text="$PKGCOUNT updates for dom0 available. Do you want to download its now?" || exit 0 --text="$PKGCOUNT updates for dom0 available. Do you want to download its now?" || exit 0
fi fi
if [ "$PKGS_FROM_CMDLINE" == 1 ]; then
OPTS="--resolve"
GUI=0
fi
mkdir -p "$DOM0_UPDATES_DIR/packages" mkdir -p "$DOM0_UPDATES_DIR/packages"
set -e set -e
if [ "$GUI" = 1 ]; then if [ "$GUI" = 1 ]; then
( echo "1" ( echo "1"
yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $PKGLIST yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $OPTS $PKGLIST
echo 100 ) | zenity --progress --pulsate --auto-close --auto-kill \ echo 100 ) | zenity --progress --pulsate --auto-close --auto-kill \
--text="Downloading updates for Dom0, please wait..." --title="Qubes Dom0 updates" --text="Downloading updates for Dom0, please wait..." --title="Qubes Dom0 updates"
else else
yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $PKGLIST yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $OPTS $PKGLIST
fi fi
if ls $DOM0_UPDATES_DIR/packages/*.rpm > /dev/null 2>&1; then
/usr/lib/qubes/qrexec_client_vm dom0 qubes.ReceiveUpdates /usr/lib/qubes/qfile-agent $DOM0_UPDATES_DIR/packages/*.rpm /usr/lib/qubes/qrexec_client_vm dom0 qubes.ReceiveUpdates /usr/lib/qubes/qfile-agent $DOM0_UPDATES_DIR/packages/*.rpm
else
echo "No packages downloaded"
fi

View File

@ -14,8 +14,13 @@ qvm-run -a $UPDATEVM true || exit 1
qvm-run --pass_io $UPDATEVM "/usr/lib/qubes/qubes_download_dom0_updates.sh $*" || exit 1 qvm-run --pass_io $UPDATEVM "/usr/lib/qubes/qubes_download_dom0_updates.sh $*" || exit 1
# Wait for download completed # Wait for download completed
while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done
if [ $# -gt 0 ]; then
echo "You can now install downloaded packages (eg. using yum)"
elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then
yum check-update yum check-update
if [ $? -ne 100 ]; then if [ $? -eq 100 ]; then
exit 0
fi
gpk-update-viewer gpk-update-viewer
fi
else
echo "No updates avaliable"
fi