Support running with sudo

This commit is contained in:
Bruno Tavares 2014-02-21 15:59:46 -03:00
parent f599567230
commit 47e692b57f
3 changed files with 10 additions and 4 deletions

View File

@ -59,7 +59,7 @@ kickstart compile
Takes an host target and deploy the compiled code on it. Takes an host target and deploy the compiled code on it.
```bash ```bash
kickstart deploy [target] [roles ...] kickstart deploy [--sudo] [target] [roles ...]
``` ```
##### Examples ##### Examples
@ -79,7 +79,7 @@ kickstart deploy "-p 2222 vagrant@localhost" nodejs redis
Deploy localy a recipe that is not over ssh. It basicaly compile and run the install script Deploy localy a recipe that is not over ssh. It basicaly compile and run the install script
```bash ```bash
kickstart local [roles ...] kickstart local [--sudo] [roles ...]
``` ```
#### infect #### infect

View File

@ -1,16 +1,20 @@
#!/bin/bash -e #!/bin/bash -e
[[ "$1" == "--sudo" ]] && prefix="sudo " && shift
target=$1 target=$1
[ "$target" ] || echo "Please, provide an ssh target" [ "$target" ] || echo "Please, provide an ssh target"
shift shift
[[ "$1" == "--sudo" ]] && prefix="sudo " && shift
remote_command=$( remote_command=$(
cat <<CMD cat <<CMD
[ -d ~/kickstart ] && rm -rf ~/kickstart [ -d ~/kickstart ] && rm -rf ~/kickstart
mkdir ~/kickstart mkdir ~/kickstart
cd ~/kickstart cd ~/kickstart
tar xz tar xz
bash install.sh $prefix bash install.sh
CMD CMD
) )

View File

@ -1,7 +1,9 @@
#!/bin/bash -e #!/bin/bash -e
[[ "$1" == "--sudo" ]] && prefix="sudo " && shift
kickstart compile $@ kickstart compile $@
( (
cd compile cd compile
bash install.sh $prefix bash install.sh
) )