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.
```bash
kickstart deploy [target] [roles ...]
kickstart deploy [--sudo] [target] [roles ...]
```
##### 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
```bash
kickstart local [roles ...]
kickstart local [--sudo] [roles ...]
```
#### infect

View File

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

View File

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