Introduce kickstart root-dir
The root-dir is important to know so we can include the kickstart as a module on compile, so projects can access the kickstart utilities on their recipes
This commit is contained in:
parent
32e708710b
commit
092e48e3fd
@ -75,6 +75,5 @@ Deploy two roles on a host with an alternative port
|
|||||||
kickstart deploy "-p 2222 vagrant@localhost" nodejs redis
|
kickstart deploy "-p 2222 vagrant@localhost" nodejs redis
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Thanks
|
### Thanks
|
||||||
This project was inspired on [sunzi](https://github.com/kenn/sunzi)
|
This project was inspired on [sunzi](https://github.com/kenn/sunzi)
|
||||||
|
29
lib/kickstart-root-dir
Executable file
29
lib/kickstart-root-dir
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/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
|
||||||
|
dirname $(dirname `_kickstart_readlink "$path_to_kickstart"`)
|
||||||
|
else
|
||||||
|
dirname $(dirname `readlink -f "$path_to_kickstart"`)
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user