Skip to content

Commit a6bc89b

Browse files
committed
#147: Allow installing specific version of CIKit
1 parent 88f6be9 commit a6bc89b

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ env:
2525

2626
install:
2727
- sudo pip install ansible
28-
- sudo bash ./install.sh --no-requirements-check
29-
- sudo wget -nv https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb
30-
- sudo dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb
28+
- sudo bash ./install.sh --no-requirements-check "${TRAVIS_BRANCH}"
29+
- sudo wget -nv "https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb"
30+
- sudo dpkg -i "vagrant_${VAGRANT_VERSION}_x86_64.deb"
3131
- cd /usr/local/share/cikit
32-
- sudo git fetch origin ${TRAVIS_BRANCH}
33-
- sudo git checkout ${TRAVIS_BRANCH}
32+
- sudo git fetch origin "${TRAVIS_BRANCH}"
33+
- sudo git checkout "${TRAVIS_BRANCH}"
3434

3535
script:
3636
- sudo ./tests/travis/tests-runner/runner.sh ./tests/travis

install.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
#!/usr/bin/env bash
22

33
INSTALL_PATH="/usr/local/share/cikit"
4+
NOCHECK="--no-requirements-check"
5+
ARGS="$*"
46

5-
if [ "--no-requirements-check" != "${1}" ]; then
7+
if [[ "$ARGS" =~ .*$NOCHECK.* ]]; then
68
MISSING=""
79

810
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"
1113
fi
1214
done
1315

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"
1618
\exit 1
1719
fi
1820
fi
1921

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"
2229
fi
2330

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"
2734
fi

0 commit comments

Comments
 (0)