From bfe06906726f12507a6c181c2ebcf7c8e6115100 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 24 Dec 2013 18:42:53 -0200 Subject: Set sudo config at hydractl deploy --- share/hydractl/deploy | 19 ++++++++++++------- 1 file 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 -- cgit v1.2.3