diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2013-12-24 18:42:53 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2013-12-24 18:42:53 -0200 |
commit | bfe06906726f12507a6c181c2ebcf7c8e6115100 (patch) | |
tree | e4f8cb244c06b1e94728ed44ec5b36d5ec68cdb1 /share/hydractl | |
parent | 6842e65fd07608d54ce64cf43612ea6ddb02d739 (diff) | |
download | hydra-bfe06906726f12507a6c181c2ebcf7c8e6115100.tar.gz hydra-bfe06906726f12507a6c181c2ebcf7c8e6115100.tar.bz2 |
Set sudo config at hydractl deploy
Diffstat (limited to 'share/hydractl')
-rwxr-xr-x | share/hydractl/deploy | 19 |
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 |