From 583720c67691db569b4babab5397a706b1f6b172 Mon Sep 17 00:00:00 2001 From: Joanna Rutkowska Date: Thu, 8 Sep 2011 14:12:56 +0200 Subject: [PATCH] dom0: qvm-dom0-upgrade: actually check if running as root only when used 'manually' --- dom0/qvm-tools/qvm-dom0-upgrade | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dom0/qvm-tools/qvm-dom0-upgrade b/dom0/qvm-tools/qvm-dom0-upgrade index 1fdb8e58..6cd40254 100755 --- a/dom0/qvm-tools/qvm-dom0-upgrade +++ b/dom0/qvm-tools/qvm-dom0-upgrade @@ -1,12 +1,5 @@ #!/bin/bash -ID=$(id -ur) - -if [ $ID != 0 ] ; then - echo "This script should be run as root, use sudo. " - exit 1 -fi - UPDATEVM=`qvm-get-updatevm` if [ -z "$UPDATEVM" ]; then @@ -27,6 +20,14 @@ qvm-run --pass_io $UPDATEVM "/usr/lib/qubes/qubes_download_dom0_updates.sh $*" | # Wait for download completed while pidof -x qubes-receive-updates >/dev/null; do sleep 0.5; done if [ $# -gt 0 ]; then + + ID=$(id -ur) + if [ $ID != 0 ] ; then + echo "This script should be run as root, use sudo next time." + echo "Now you can manually run yum install (use sudo again)." + exit + fi + yum install $@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then yum check-update