aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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