From: Silvio Rhatto Date: Tue, 24 Dec 2013 20:42:53 +0000 (-0200) Subject: Set sudo config at hydractl deploy X-Git-Tag: 0.2~19 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=bfe06906726f12507a6c181c2ebcf7c8e6115100;p=hydra.git Set sudo config at hydractl deploy --- 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