Add kickstart binary command with instalation instructions

This commit is contained in:
Bruno Tavares 2014-02-19 20:10:40 -03:00
parent 88d24a4937
commit db2cd4a4e3
3 changed files with 68 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.baseline
compile

View File

@ -1 +1,28 @@
# kickstart
Bash installation script for developer environments
### Installation
Add it to the path.
One options is to download it, and export the bin folder into your PATH
```bash
# Adjust the paths to your preferred location
installation_path=/opt/kickstart
shell_configuration=$HOME/.bashrc
git clone https://github.com/bltavares/kickstart.git $installation_path
echo 'export PATH=$PATH:'$installation_path'/bin' >> $shell_configuration
```
The other is to link the `bin/kickstart` into a place that is already on your path
```bash
# Adjust the paths to your preferred location
installation_path=/opt/kickstart
shell_configuration=$HOME/.bashrc
git clone https://github.com/bltavares/kickstart.git $installation_path
sudo ln -s $installation_path/bin/kickstart /usr/local/bin/kickstart
```
### Thanks
This project was inspired on [sunzi](https://github.com/kenn/sunzi)

39
bin/kickstart Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
_kickstart_readlink() {
(
TARGET_FILE=$1
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
while [ -L "$TARGET_FILE" ]
do
TARGET_FILE=`readlink $TARGET_FILE`
cd `dirname $TARGET_FILE`
TARGET_FILE=`basename $TARGET_FILE`
done
PHYS_DIR=`pwd -P`
RESULT=$PHYS_DIR/$TARGET_FILE
echo $RESULT
)
}
path_to_kickstart=`which kickstart`
if [[ `uname` == "Darwin" ]]; then
curr_dir=$(dirname `_kickstart_readlink "$path_to_kickstart"`)
else
curr_dir=$(dirname `readlink -f "$path_to_kickstart"`)
fi
command=$1
shift
command_file="$curr_dir"/../lib/kickstart-$command
if ! [[ -x $command_file ]]; then
echo "Command does not exist. Run kickstart help"
exit 1
fi
exec $command_file "$@"