|
1 | 1 | #!/usr/bin/env bash |
2 | 2 |
|
3 | 3 | INSTALL_PATH="/usr/local/share/cikit" |
| 4 | +NOCHECK="--no-requirements-check" |
| 5 | +ARGS="$*" |
4 | 6 |
|
5 | | -if [ "--no-requirements-check" != "${1}" ]; then |
| 7 | +if [[ "$ARGS" =~ .*$NOCHECK.* ]]; then |
6 | 8 | MISSING="" |
7 | 9 |
|
8 | 10 | for COMMAND in vagrant VBoxManage ansible-playbook; do |
9 | | - if ! \command -v "${COMMAND}" > /dev/null; then |
10 | | - MISSING+="\n- ${COMMAND}" |
| 11 | + if ! \command -v "$COMMAND" > /dev/null; then |
| 12 | + MISSING+="\n- $COMMAND" |
11 | 13 | fi |
12 | 14 | done |
13 | 15 |
|
14 | | - if [ -n "${MISSING}" ]; then |
15 | | - \echo -e "The following software were not found on your machine, so continuation is not possible:${MISSING}" |
| 16 | + if [ -n "$MISSING" ]; then |
| 17 | + \echo -e "The following software were not found on your machine, so continuation is not possible:$MISSING" |
16 | 18 | \exit 1 |
17 | 19 | fi |
18 | 20 | fi |
19 | 21 |
|
20 | | -if [ ! -d "${INSTALL_PATH}" ]; then |
21 | | - sudo \mkdir -p "${INSTALL_PATH}" |
| 22 | +ARGS="${ARGS//$NOCHECK/}" |
| 23 | +VERSION="$(\tr -d '[:blank:]' <<< "$ARGS")" |
| 24 | + |
| 25 | +: "${VERSION:="master"}" |
| 26 | + |
| 27 | +if [ ! -d "$INSTALL_PATH" ]; then |
| 28 | + sudo \mkdir -p "$INSTALL_PATH" |
22 | 29 | fi |
23 | 30 |
|
24 | | -if sudo \git clone https://github.com/BR0kEN-/cikit.git --recursive "${INSTALL_PATH}"; then |
25 | | - sudo \ln -s "${INSTALL_PATH}/lib/cikit" /usr/local/bin/cikit |
26 | | - sudo \chown -R "$(\whoami)" "${INSTALL_PATH}" |
| 31 | +if sudo \git clone https://github.com/BR0kEN-/cikit.git --recursive --version="$VERSION" "$INSTALL_PATH"; then |
| 32 | + sudo \ln -s "$INSTALL_PATH/lib/cikit" /usr/local/bin/cikit |
| 33 | + sudo \chown -R "$(\whoami)" "$INSTALL_PATH" |
27 | 34 | fi |
0 commit comments