From: Silvio Rhatto Date: Wed, 24 Jul 2013 13:34:35 +0000 (-0300) Subject: Enhancing hydractl upgrade X-Git-Tag: 0.1~5 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=2a8dab4cb169a79ce511832f167117e60f278485;p=hydra.git Enhancing hydractl upgrade --- diff --git a/share/hydractl/upgrade b/share/hydractl/upgrade index 81c38ae..7b7d4b5 100755 --- a/share/hydractl/upgrade +++ b/share/hydractl/upgrade @@ -16,4 +16,15 @@ # License along with this program. If not, see # . -aptitude safe-upgrade -y +# Set sudo config +local sudo device rsync +if [ "`whoami`" != 'root' ]; then + sudo="sudo" +fi + +if ! $sudo lsof /var/lib/dpkg/lock &> /dev/null; then + $sudo aptitude update + $sudo aptitude safe-upgrade -y +else + echo "Apt is locked, aborting." +fi