16 | | # |
17 | | # Install a Sahana Eden Developer environment in Ubuntu |
18 | | # - tested on 10.04 and 11.10 |
19 | | # |
20 | | |
21 | | f_Quick() { |
22 | | MODE="quick" |
23 | | } |
24 | | f_Medium() { |
25 | | MODE="medium" |
26 | | } |
27 | | f_Full() { |
28 | | MODE="full" |
29 | | } |
30 | | |
31 | | if [[ -z "$1" ]]; then |
32 | | # Offer a menu |
33 | | echo "Welcome to the Sahana Eden Dev Installation script for Ubuntu." |
34 | | echo "This will install a working verion of Sahana Eden into ~/web2py." |
35 | | echo |
36 | | echo "Select the Installation Type:" |
37 | | echo |
38 | | echo "1. Medium - installs all mandatory and some common optional dependencies. It is the normal recommended option." |
39 | | echo "2. Quick - installs only mandatory dependencies. This is recommended if you are on a slow Internet connection or need to get operational quickly." |
40 | | echo "3. Full - installs all optional dependencies & the Eclipse debugger. It is only recommended if you are on a fast Internet connection & are prepared to be patient." |
41 | | echo |
42 | | echo -n "Your choice? : " |
43 | | read choice |
44 | | |
45 | | case "$choice" in |
46 | | 1) f_Medium ;; |
47 | | 2) f_Quick ;; |
48 | | 3) f_Full ;; |
49 | | *) echo "\"$choice\" is not valid" ; exit ;; |
50 | | esac |
51 | | elif [[ "$1" = "quick" ]]; then |
52 | | # Set the option direct |
53 | | MODE="quick" |
54 | | elif [[ "$1" = "medium" ]]; then |
55 | | # Set the option direct |
56 | | MODE="medium" |
57 | | elif [[ "$1" = "full" ]]; then |
58 | | # Set the option direct |
59 | | MODE="full" |
60 | | else |
61 | | echo >&2 "$1 is not a valid option!\nPlease use either 'quick', 'medium' or 'full'" |
62 | | exit 1 |
63 | | fi |
64 | | |
65 | | # Install Git |
66 | | sudo apt-get install git-core |
67 | | # Install Python Libs |
68 | | #sudo apt-get install -y python2.7 python-dateutil |
69 | | sudo apt-get install -y python-lxml python-shapely |
70 | | |
71 | | if [[ "$MODE" = "medium" ]]; then |
72 | | sudo apt-get -y install python-reportlab python-xlrd python-xlwt |
73 | | elif [[ "$MODE" = "full" ]]; then |
74 | | sudo apt-get -y install python-reportlab python-xlrd python-xlwt |
75 | | sudo apt-get -y install python-matplotlib python-numpy python-xlrd |
76 | | sudo apt-get -y install eclipse-platform |
77 | | fi |
78 | | |
79 | | # Install Web2Py |
80 | | cd /home |
81 | | if [[ "$MODE" = "full" ]]; then |
82 | | git clone git://github.com/mdipierro/web2py.git |
83 | | else |
84 | | # Install the stable version |
85 | | wget http://www.web2py.com/examples/static/web2py_src.zip |
86 | | unzip web2py_src.zip |
87 | | fi |
88 | | |
89 | | cat << EOF > /home/web2py/routes.py |
90 | | #!/usr/bin/python |
91 | | default_application = 'eden' |
92 | | default_controller = 'default' |
93 | | default_function = 'index' |
94 | | routes_onerror = [ |
95 | | ('eden/400', '!'), |
96 | | ('eden/401', '!'), |
97 | | ('eden/*', '/eden/errors/index'), |
98 | | ('*/*', '/eden/errors/index'), |
99 | | ] |
100 | | EOF |
101 | | |
102 | | # Install Eden |
103 | | cd /home/web2py/applications |
104 | | git clone git://github.com/flavour/eden.git |
105 | | cp /home/web2py/applications/eden/private/templates/000_config.py /home/web2py/applications/eden/models |
106 | | sed -i 's|EDITING_CONFIG_FILE = False|EDITING_CONFIG_FILE = True|' /home/web2py/applications/eden/models/000_config.py |
107 | | |
108 | | echo -n "What is your username? : " |
109 | | read username |
110 | | chown -R $username /home/web2py |
111 | | |
112 | | echo "Installation is now complete - you can run Sahana either by using the Eclipse debugger or else by running:" |
113 | | echo "cd /home/web2py ; python web2py.py -a eden" |
114 | | echo "Then run Sahana by pointing your web browser at http://127.0.0.1:8000" |
115 | | echo "Be patient on the 1st run as the database needs to be created" |
116 | | }}} |