Mercurial > hg > config
comparison bin/install-k0s-web.sh @ 921:02b31a76e2c4
get DEST from command line
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Sun, 02 Jun 2024 16:35:01 -0700 |
| parents | 531a7200649f |
| children |
comparison
equal
deleted
inserted
replaced
| 920:531a7200649f | 921:02b31a76e2c4 |
|---|---|
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 | 2 |
| 3 set -exuo pipefail | 3 # This script installs the k0s.org web server in a virtual environment |
| 4 # in the directory specified by the first argument. | |
| 5 | |
| 6 # Example usage: | |
| 7 # install-k0s-web.sh "${HOME}"/web2 | |
| 8 | |
| 9 set -euo pipefail | |
| 4 | 10 |
| 5 PYTHON_VERSION="3.7" | 11 PYTHON_VERSION="3.7" |
| 6 | 12 |
| 7 # TODO: take this from "$1" | 13 # Get DEST from "$1" |
| 8 DEST="${HOME}/web3" | 14 # DEST="${HOME}/web3" |
| 15 if [ "$#" -ne 1 ]; then | |
| 16 echo "Usage: $0 <destination>" | |
| 17 exit 1 | |
| 18 fi | |
| 19 DEST="$1" | |
| 20 if [ "${DEST:0:1}" != "/" ] | |
| 21 then | |
| 22 echo "Destination must be an absolute path" | |
| 23 exit 1 | |
| 24 fi | |
| 25 beginswith() { case $2 in "$1"*) true;; *) false;; esac; } | |
| 26 if ! beginswith "${HOME}" "${DEST}" | |
| 27 then | |
| 28 echo "Destination must be under your home directory" | |
| 29 exit 1 | |
| 30 fi | |
| 31 | |
| 32 set -x | |
| 33 | |
| 9 rm -rf "${DEST}" | 34 rm -rf "${DEST}" |
| 10 | 35 |
| 11 # Make a directory for k0s.org web | 36 # Make a directory for k0s.org web |
| 12 mkdir -p "${DEST}" | 37 mkdir -p "${DEST}" |
| 13 cd "${DEST}" | 38 cd "${DEST}" |
| 27 # Install the required packages | 52 # Install the required packages |
| 28 bin/pip install --upgrade pip | 53 bin/pip install --upgrade pip |
| 29 bin/pip install -r "${HOME}"/web/requirements.txt | 54 bin/pip install -r "${HOME}"/web/requirements.txt |
| 30 | 55 |
| 31 # echo command to run the server | 56 # echo command to run the server |
| 57 set +x | |
| 32 command="sudo ${DEST}/bin/paster serve /home/jhammel/web/paster-wsgintegrate.ini" | 58 command="sudo ${DEST}/bin/paster serve /home/jhammel/web/paster-wsgintegrate.ini" |
| 33 echo "Run with:" | 59 echo "Run with:" |
| 34 echo "${command}" | 60 echo "${command}" |
