#!/usr/bin/env bash # This can be called as: # curl -L docker.iotempower.us | bash - # # If you use -s, you can add parameters to the install script # (for example you can call the tests directly, # commands have to be added after --) # Example: curl -L docker.iotempower.us | bash -s -- test compilation # # You can overwrite the repo to use with setting IOTEMPOWER_REPO to your repo url # to test an IoTempower local repo that is checked out to ~/iot, you can run this: # cat iot/bin/curl_install_docker | IOTEMPOWER_REPO=~/iot bash -s -- test compilation command -v git &>/dev/null || { echo "git is not installed. Please install it." echo "On Debian systems, you can do this using 'sudo apt update && sudo apt install git'."; exit 1 } mkdir "$HOME/iot-container" if [ -z "$IOTEMPOWER_REPO" ]; then IOTEMPOWER_REPO="https://github.com/iotempire/iotempower" fi git clone "$IOTEMPOWER_REPO" "$HOME/iot-container/repo" if [ ! -d "$HOME/iot" ]; then ln -s "$HOME/iot-container/repo" "$HOME/iot" fi if [ ! -d "$HOME/iot-systems" ]; then ln -s "$HOME/iot-container/iot-systems" "$HOME/iot-systems" fi cd "$HOME/iot-container/repo" || exit 1 git config pull.rebase false iot_root_tmp="$HOME/iot-container/repo" IOTEMPOWER_ROOT="$iot_root_tmp" bin/iot_activate_iot_script "$iot_root_tmp/examples/scripts/iot-docker" docker pull ulno/iotempower # run it (and unpack the environment) if ([ -t 0 ] || [ -t 1 ]) && [ -e /dev/tty ] && [ -r /dev/tty ] && [ -w /dev/tty ]; then bash "$iot_root_tmp/examples/scripts/iot-docker" "$@" < /dev/tty else bash "$iot_root_tmp/examples/scripts/iot-docker" "$@" fi