source: OpenWorkouts-current/bin/install @ 4af38e8

currentfeature/docs
Last change on this file since 4af38e8 was 4af38e8, checked in by Borja Lopez <borja@…>, 5 years ago

Fixed broken bin/install

(wrong name when calling a method that fixes some permissions in dependency
scripts)

  • Property mode set to 100755
File size: 2.2 KB
Line 
1#!/bin/sh
2#
3# Script to install OpenWorkouts for development
4#
5
6# Full path to where we run the script from
7current=`pwd`
8# Full path to the main python binary (will be set by check_python3())
9python_bin=''
10# Full path to the env
11env_path=${current}/env
12
13
14set_scripts_permissions() {
15    # ensure the shell scripts we will need have proper permissions
16    chmod u+x ${current}/bin/js_deps
17    chmod u+x ${current}/bin/start
18}
19
20check_python3() {
21    # if python3 is not installed, exit with an error
22    if command -v python3 > /dev/null; then
23        # ok
24        python_bin=`command -v python3`
25        return
26    else
27        # no python3 binary, look for python
28        if command -v python > /dev/null; then
29            # python found, check if it is 3.x
30            if `command -v python` -c "import sys; exit(0) if sys.version.startswith('3.') else exit(1)"; then
31                python_bin=`command -v python`
32                return
33            else
34                # no python binary, error
35                echo "Error: could not find a suitable python version installed, please install python 3.x"
36                exit 1
37            fi
38        else
39            # no python binary, error
40            echo "Error: could not find a suitable python version installed, please install python 3.x"
41            exit 1
42        fi
43    fi
44}
45
46create_venv() {
47    # create a new virtual environment
48    ${python_bin} -m venv ${env_path}
49}
50
51upgrade_pip_setuptools() {
52    . ${env_path}/bin/activate
53    yes | pip install --upgrade setuptools pip
54    deactivate
55}
56
57install_openworkouts() {
58    . ${env_path}/bin/activate
59    yes | pip install --upgrade -e ${current}[testing]
60    deactivate
61}
62
63install_js_deps() {
64    ${current}/bin/js_deps
65}
66
67setup_start_stop() {
68    echo "OpenWorkouts successfully installed in ${env_path}"
69    echo ""
70    echo "You can now start the OpenWorkouts service calling:"
71    echo ""
72    echo "  cd ${current} && ./bin/start"
73    echo ""
74    # echo "You can stop any running OpenWorkouts instances calling:"
75    # echo ""
76    # echo "  ${current}/bin/stop"
77    # echo ""
78}
79
80set_scripts_permissions
81check_python3
82create_venv
83upgrade_pip_setuptools
84install_openworkouts
85install_js_deps
86setup_start_stop
87
88echo ${python_bin}
Note: See TracBrowser for help on using the repository browser.