40 lines
835 B
Bash
Executable File
40 lines
835 B
Bash
Executable File
#!/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:-help}
|
|
shift
|
|
|
|
command_file="$curr_dir"/../lib/kickstart-$command
|
|
|
|
if ! [[ -x $command_file ]]; then
|
|
echo "\"kickstart $command\" is not a subcommand. Run \"kickstart help\" for more information."
|
|
exit 1
|
|
fi
|
|
|
|
exec "$command_file" "$@"
|