Support running with sudo
This commit is contained in:
		@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user