dom0/qvm-dom0-update: Check if running as root at the beginning
This commit is contained in:
parent
93832b29db
commit
3dd6d654ea
@ -17,6 +17,12 @@ if [ "$1" = "--help" ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ID=$(id -ur)
|
||||||
|
if [ $ID != 0 ] ; then
|
||||||
|
echo "This script should be run as root, use sudo."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
# We should ensure the clocks in Dom0 and UpdateVM are in sync
|
# We should ensure the clocks in Dom0 and UpdateVM are in sync
|
||||||
# becuase otherwise yum might complain about future timestamps
|
# becuase otherwise yum might complain about future timestamps
|
||||||
qvm-sync-dom0-clock
|
qvm-sync-dom0-clock
|
||||||
@ -49,25 +55,11 @@ while [ $# -gt 0 ]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ "x$PKGS" != "x" ]; then
|
if [ "x$PKGS" != "x" ]; 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 $OPTS install $PKGS
|
yum $OPTS install $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
|
||||||
yum check-update
|
yum check-update
|
||||||
if [ $? -eq 100 ]; then
|
if [ $? -eq 100 ]; 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 update (use sudo again)."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
yum $OPTS update
|
yum $OPTS update
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user