]> gitweb.fluxo.info Git - hydra.git/commitdiff
Enhancing hydractl upgrade
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 24 Jul 2013 13:34:35 +0000 (10:34 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 24 Jul 2013 13:34:35 +0000 (10:34 -0300)
share/hydractl/upgrade

index 81c38ae188d25cc15ca5eaf579a58953fd9ae481..7b7d4b57ede7c0bb7efcab2d8c4e4d9a2dfb6e0a 100755 (executable)
 # 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