Introduce kickstart bootstrap
This commit is contained in:
parent
b848aa5799
commit
424a7166df
20
README.md
20
README.md
@ -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
18
lib/kickstart-bootstrap
Executable 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"
|
Loading…
Reference in New Issue
Block a user