aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-12-24 18:42:53 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-12-24 18:42:53 -0200
commitbfe06906726f12507a6c181c2ebcf7c8e6115100 (patch)
treee4f8cb244c06b1e94728ed44ec5b36d5ec68cdb1
parent6842e65fd07608d54ce64cf43612ea6ddb02d739 (diff)
downloadhydra-bfe06906726f12507a6c181c2ebcf7c8e6115100.tar.gz
hydra-bfe06906726f12507a6c181c2ebcf7c8e6115100.tar.bz2
Set sudo config at hydractl deploy
-rwxr-xr-xshare/hydractl/deploy19
1 files changed, 12 insertions, 7 deletions
diff --git a/share/hydractl/deploy b/share/hydractl/deploy
index 1411e36..b9201ea 100755
--- a/share/hydractl/deploy
+++ b/share/hydractl/deploy
@@ -25,21 +25,26 @@ if [ -z "$ORIGIN" ]; then
ORIGIN="git://git.sarava.org/hydra.git"
fi
+# Set sudo config
+if [ "`whoami`" != 'root' ]; then
+ sudo="sudo"
+fi
+
# Deploy
echo "Deploying to local node..."
if ! which git &> /dev/null; then
echo "Installing git..."
- sudo aptitude update
- sudo aptitude install git-core -y
+ $sudo aptitude update
+ $sudo aptitude install git-core -y
fi
if [ ! -d /usr/local/hydra ]; then
- sudo git clone $ORIGIN /usr/local/hydra
+ $sudo git clone $ORIGIN /usr/local/hydra
( cd /usr/local/hydra ; sudo git reset --hard $COMMIT )
- sudo ln -sf /usr/local/hydra/hydra /usr/local/sbin/hydra
- sudo ln -sf /usr/local/hydra/hydra /usr/local/sbin/hydractl
- sudo ln -sf /usr/local/hydra/hydras /usr/local/sbin/hydras
+ $sudo ln -sf /usr/local/hydra/hydra /usr/local/sbin/hydra
+ $sudo ln -sf /usr/local/hydra/hydra /usr/local/sbin/hydractl
+ $sudo ln -sf /usr/local/hydra/hydras /usr/local/sbin/hydras
else
- ( cd /usr/local/hydra ; sudo git pull ; sudo git reset --hard $COMMIT )
+ ( cd /usr/local/hydra ; $sudo git pull ; $sudo git reset --hard $COMMIT )
fi