Skip to content

Commit

Permalink
#147: Allow installing specific version of CIKit
Browse files Browse the repository at this point in the history
  • Loading branch information
BR0kEN- committed Jul 8, 2018
1 parent 88f6be9 commit a6bc89b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ env:

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

script:
- sudo ./tests/travis/tests-runner/runner.sh ./tests/travis
Expand Down
27 changes: 17 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#!/usr/bin/env bash

INSTALL_PATH="/usr/local/share/cikit"
NOCHECK="--no-requirements-check"
ARGS="$*"

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

for COMMAND in vagrant VBoxManage ansible-playbook; do
if ! \command -v "${COMMAND}" > /dev/null; then
MISSING+="\n- ${COMMAND}"
if ! \command -v "$COMMAND" > /dev/null; then
MISSING+="\n- $COMMAND"
fi
done

if [ -n "${MISSING}" ]; then
\echo -e "The following software were not found on your machine, so continuation is not possible:${MISSING}"
if [ -n "$MISSING" ]; then
\echo -e "The following software were not found on your machine, so continuation is not possible:$MISSING"
\exit 1
fi
fi

if [ ! -d "${INSTALL_PATH}" ]; then
sudo \mkdir -p "${INSTALL_PATH}"
ARGS="${ARGS//$NOCHECK/}"
VERSION="$(\tr -d '[:blank:]' <<< "$ARGS")"

: "${VERSION:="master"}"

if [ ! -d "$INSTALL_PATH" ]; then
sudo \mkdir -p "$INSTALL_PATH"
fi

if sudo \git clone https://github.com/BR0kEN-/cikit.git --recursive "${INSTALL_PATH}"; then
sudo \ln -s "${INSTALL_PATH}/lib/cikit" /usr/local/bin/cikit
sudo \chown -R "$(\whoami)" "${INSTALL_PATH}"
if sudo \git clone https://github.com/BR0kEN-/cikit.git --recursive --version="$VERSION" "$INSTALL_PATH"; then
sudo \ln -s "$INSTALL_PATH/lib/cikit" /usr/local/bin/cikit
sudo \chown -R "$(\whoami)" "$INSTALL_PATH"
fi

0 comments on commit a6bc89b

Please sign in to comment.