summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-07-24 10:34:35 -0300
committerSilvio Rhatto <rhatto@riseup.net>2013-07-24 10:34:35 -0300
commit2a8dab4cb169a79ce511832f167117e60f278485 (patch)
tree127611d0329418f6ea1a2c1d9a75775f2aec1274
parent69441f525dde047ac67d476ede715ed38ac2671f (diff)
downloadhydra-2a8dab4cb169a79ce511832f167117e60f278485.tar.gz
hydra-2a8dab4cb169a79ce511832f167117e60f278485.tar.bz2
Enhancing hydractl upgrade
-rwxr-xr-xshare/hydractl/upgrade13
1 files changed, 12 insertions, 1 deletions
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
# <http://www.gnu.org/licenses/>.
-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