dom0: qvm-dom0-upgrade: actually check if running as root only when used 'manually'

This commit is contained in:
Joanna Rutkowska 2011-09-08 14:12:56 +02:00
parent 89d532ef11
commit 583720c676

View File

@ -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