From 2a8dab4cb169a79ce511832f167117e60f278485 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 24 Jul 2013 10:34:35 -0300 Subject: Enhancing hydractl upgrade --- share/hydractl/upgrade | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'share/hydractl') 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 -- cgit v1.2.3