Introduce kickstart bootstrap

This commit is contained in:
Bruno Tavares 2014-02-21 17:00:16 -03:00
parent b848aa5799
commit 424a7166df
2 changed files with 38 additions and 0 deletions

View File

@ -89,5 +89,25 @@ Infect your shell with the kickstart utility functions
eval "$(kickstart infect)"
```
#### bootstrap
Install kickstart on the target
```bash
kickstart bootstratp [target]
```
##### Example
Using default ssh configurations
```bash
kickstart bootstrap vagrant@vagrant
```
Using alternate ssh port
```bash
kickstart bootstrap "-p 2222 vagrant@vagrant"
```
### Thanks
This project was inspired on [sunzi](https://github.com/kenn/sunzi)

18
lib/kickstart-bootstrap Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash -e
target=$1
[ "$target" ] || echo "Please, provide an ssh target"
shift
remote_command=$(
cat <<CMD
[ -d ~/opt/kickstart ] && rm -rf ~/opt/kickstart
mkdir -p ~/opt/kickstart
cd ~/opt/kickstart
tar xz
echo 'PATH=~/opt/kickstart/bin:\$PATH' >> ~/.bashrc
echo 'PATH=~/opt/kickstart/bin:\$PATH' >> ~/.zshrc
CMD
)
tar chz -C `kickstart root-dir` . | ssh $target "$remote_command"