aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'share/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