1 | #!/bin/bash
|
---|
2 | set -e
|
---|
3 |
|
---|
4 | #
|
---|
5 | # Install a Sahana Eden Developer environment in Fedora/RHEL
|
---|
6 | # - tested on Fedora 20
|
---|
7 | #
|
---|
8 |
|
---|
9 | f_Quick() {
|
---|
10 | MODE="quick"
|
---|
11 | }
|
---|
12 | f_Medium() {
|
---|
13 | MODE="medium"
|
---|
14 | }
|
---|
15 | f_Full() {
|
---|
16 | MODE="full"
|
---|
17 | }
|
---|
18 | if [[ -z "$1" ]]; then
|
---|
19 | # Offer a menu
|
---|
20 | echo "Welcome to the Sahana Eden Dev Installation script for Ubuntu/Debian."
|
---|
21 | echo "This will install a working verion of Sahana Eden into /home/web2py"
|
---|
22 | echo
|
---|
23 | echo "Select the Installation Type:"
|
---|
24 | echo
|
---|
25 | echo "1. Medium - installs all mandatory and some common optional dependencies. It is the normal recommended option."
|
---|
26 | echo "2. Quick - installs only mandatory dependencies. This is recommended if you are on a slow Internet connection or need to get operational quickly."
|
---|
27 | echo "3. Full - installs all optional dependencies"
|
---|
28 | echo
|
---|
29 | echo -n "Your choice (Enter 1/2/3 depending on your requirements) ? : "
|
---|
30 | read choice
|
---|
31 | case "$choice" in
|
---|
32 | 1) f_Medium ;;
|
---|
33 | 2) f_Quick ;;
|
---|
34 | 3) f_Full ;;
|
---|
35 | *) echo "\"$choice\" is not valid" ; exit ;;
|
---|
36 | esac
|
---|
37 | elif [[ "$1" = "quick" ]]; then
|
---|
38 | MODE="quick"
|
---|
39 | elif [[ "$1" = "medium" ]]; then
|
---|
40 | MODE="medium"
|
---|
41 | elif [[ "$1" = "full" ]]; then
|
---|
42 | MODE="full"
|
---|
43 | else
|
---|
44 | echo >&2 "$1 is not a valid option!\nPlease use either 'quick', 'medium' or 'full'"
|
---|
45 | exit 1
|
---|
46 | fi
|
---|
47 |
|
---|
48 | # Install Git
|
---|
49 | sudo yum install -y git
|
---|
50 |
|
---|
51 | # Install Python Libs
|
---|
52 | sudo yum install -y python-lxml python-shapely python-dateutil
|
---|
53 | if [[ "$MODE" = "medium" ]]; then
|
---|
54 | sudo yum -y install python-reportlab python-xlrd python-xlwt
|
---|
55 | elif [[ "$MODE" = "full" ]]; then
|
---|
56 | sudo yum -y install python-reportlab python-xlrd python-xlwt
|
---|
57 | sudo yum -y install python-matplotlib numpy
|
---|
58 | fi
|
---|
59 |
|
---|
60 | # Install Web2Py
|
---|
61 | cd ~
|
---|
62 |
|
---|
63 | # In case the user has already tried installing but had stopped in between
|
---|
64 | # A better solution would be to add a check if the dir exists and
|
---|
65 | # ask the user if he wants to delete it or not
|
---|
66 | # rm -rf web2py
|
---|
67 |
|
---|
68 | git clone git://github.com/web2py/web2py.git
|
---|
69 |
|
---|
70 | cat << EOF > /home/web2py/routes.py
|
---|
71 | #!/usr/bin/python
|
---|
72 | default_application = 'eden'
|
---|
73 | default_controller = 'default'
|
---|
74 | default_function = 'index'
|
---|
75 | routes_onerror = [
|
---|
76 | ('eden/400', '!'),
|
---|
77 | ('eden/401', '!'),
|
---|
78 | ('eden/*', '/eden/errors/index'),
|
---|
79 | ('*/*', '/eden/errors/index'),
|
---|
80 | ]
|
---|
81 | EOF
|
---|
82 |
|
---|
83 | # Install Eden
|
---|
84 | cd /home/web2py/applications
|
---|
85 | git clone git://github.com/flavour/eden.git
|
---|
86 | cp /home/web2py/applications/eden/modules/templates/000_config.py /home/web2py/applications/eden/models
|
---|
87 | sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' /home/web2py/applications/eden/models/000_config.py
|
---|
88 | echo -n "What is your username (Please enter your computer's username, and not your web2py username)? : "
|
---|
89 |
|
---|
90 | read username
|
---|
91 | if id -u $username >/dev/null 2>&1; then
|
---|
92 | chown -R $username /home/web2py
|
---|
93 | echo "Installation is now complete - you can run Sahana by running:"
|
---|
94 | echo "cd /home/web2py; python web2py.py -a eden"
|
---|
95 | echo "Then run Sahana by pointing your web browser at http://127.0.0.1:8000"
|
---|
96 | echo "Be patient on the 1st run as the database needs to be created"
|
---|
97 | else
|
---|
98 | echo "username entered doesn't seem to be valid."
|
---|
99 | fi
|
---|