Description:
update install.sh to work with latest ubuntu LTS
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r266:88b545da976a - - 1 file changed: 13 inserted, 0 deleted

@@ -34,156 +34,169
34 34 rvm install $RUBY_VERSION
35 35 rvm use $RUBY_VERSION
36 36
37 37 echo "Fetching Cafe Grader from Git repositories"
38 38
39 39 echo "Fetching web interface"
40 40
41 41 mkdir cafe_grader
42 42 cd cafe_grader
43 43 git clone -q git://github.com/cafe-grader-team/cafe-grader-web.git web
44 44
45 45 echo "Configuring rails app"
46 46
47 47 cp web/config/application.rb.SAMPLE web/config/application.rb
48 48 cp web/config/initializers/cafe_grader_config.rb.SAMPLE web/config/initializers/cafe_grader_config.rb
49 49
50 50 #replace UTC in application.rb with the system timezone
51 51 timezone='UTC'
52 52 if [ -f '/etc/timezone' ]; then
53 53 timezone=\"`cat /etc/timezone`\"
54 54 else
55 55 if [ -f '/etc/sysconfig/clock' ]; then
56 56 timezone=`grep -e '^TIMEZONE' /etc/sysconfig/clock | grep -o -e '\".*\"'`
57 57 fi
58 58 fi
59 59 replace="s!'UTC'!$timezone!g"
60 60 sed -i $replace web/config/application.rb
61 61
62 62 echo "At this point we will need MySQL user and database."
63 63 echo "Have you created MySQL user and database for Cafe grader? (Y/N) "
64 64 read ch
65 65
66 66 if [ "$ch" = "n" -o "$ch" = "N" ]
67 67 then
68 68 echo "Please open another terminal and create the user and database for Cafe grader."
69 69 echo "Don't forget to grant access to that database for the user."
70 70 echo "Please have username, password, and database name ready before continue."
71 71 echo
72 72 echo "The following are instructions:"
73 73 echo "1. Run mysql:"
74 74 echo
75 75 echo " mysql -u root -p"
76 76 echo
77 77 echo " if you have just installed mysql, the root password is the one that you have just entered"
78 78 echo "2. Create a new database, a new user, and grant access to grader database:"
79 79 echo
80 80 echo " create user 'USERNAME'@'localhost' identified by 'PASSWORD';"
81 81 echo " create database \`DATABASENEME\`;"
82 82 echo " grant all on \`DATABASENAME\`.* to 'USERNAME'@'localhost';"
83 83 echo
84 84 echo " Replace USERNAME, PASSWORD, and DATABASENAME accordingly."
85 85 echo
86 86 echo "Hit enter when ready..."
87 87 read dummy
88 88 fi
89 89
90 90 CAFE_PATH=`pwd`
91 91
92 92 cd web
93 93
94 94 echo "Please provide grader database:"
95 95 read database
96 96
97 97 echo "Please provide grader username:"
98 98 read username
99 99
100 100 echo "Please provide $username password:"
101 101 read password
102 102
103 103 echo "development:" > config/database.yml
104 104 echo " adapter: mysql2" >> config/database.yml
105 105 echo " encoding: utf8" >> config/database.yml
106 106 echo " reconnect: false" >> config/database.yml
107 107 echo " database: $database" >> config/database.yml
108 108 echo " pool: 5" >> config/database.yml
109 109 echo " username: $username" >> config/database.yml
110 110 echo " password: $password" >> config/database.yml
111 111 echo " host: localhost" >> config/database.yml
112 112 echo " socket: /var/run/mysqld/mysqld.sock" >> config/database.yml
113 113 echo "" >> config/database.yml
114 114 echo "production:" >> config/database.yml
115 115 echo " adapter: mysql2" >> config/database.yml
116 116 echo " encoding: utf8" >> config/database.yml
117 117 echo " reconnect: false" >> config/database.yml
118 118 echo " database: $database" >> config/database.yml
119 119 echo " pool: 5" >> config/database.yml
120 120 echo " username: $username" >> config/database.yml
121 121 echo " password: $password" >> config/database.yml
122 122 echo " host: localhost" >> config/database.yml
123 123 echo " socket: /var/run/mysqld/mysqld.sock" >> config/database.yml
124 124
125 125 echo "Object.instance_eval{remove_const :GRADER_ROOT_DIR}" >> config/initializers/cafe_grader_config.rb
126 126 echo "Object.instance_eval{remove_const :GRADING_RESULT_DIR}" >> config/initializers/cafe_grader_config.rb
127 127 echo "GRADER_ROOT_DIR = '$CAFE_PATH/judge'" >> config/initializers/cafe_grader_config.rb
128 128 echo "GRADING_RESULT_DIR = '$CAFE_PATH/judge/result'" >> config/initializers/cafe_grader_config.rb
129 129
130 + # setup secret file
131 + SECRET_A=`rake secret`
132 + SECRET_B=`rake secret`
133 + SECRET_C=`rake secret`
134 + echo "development:" > config/secrets.yml
135 + echo " secret_key_base: '$SECRET_A'" >> config/secrets.yml
136 + echo "test:" >> config/secrets.yml
137 + echo " secret_key_base: '$SECRET_B'" >> config/secrets.yml
138 + echo "production:" >> config/secrets.yml
139 + echo " secret_key_base: '$SECRET_C'" >> config/secrets.yml
140 +
141 +
142 +
130 143 echo "Installing required gems"
131 144 gem install bundler
132 145 bundle install
133 146
134 147 echo "Running rake tasks to initialize database"
135 148
136 149 rake db:migrate
137 150 rake db:seed
138 151
139 152 echo "Running rake tasks to precompile the assets"
140 153
141 154 rake assets:precompile
142 155
143 156 echo "Intalling web interface complete..."
144 157 echo
145 158 echo "Fetching grader"
146 159
147 160 cd ..
148 161
149 162 mkdir judge
150 163 cd judge
151 164 git clone -q git://github.com/cafe-grader-team/cafe-grader-judge-scripts.git scripts
152 165 mkdir raw
153 166 mkdir ev-exam
154 167 mkdir ev
155 168 mkdir result
156 169 mkdir log
157 170
158 171 echo "Configuring grader"
159 172
160 173 cp scripts/config/env_exam.rb.SAMPLE scripts/config/env_exam.rb
161 174 cp scripts/config/env_grading.rb.SAMPLE scripts/config/env_grading.rb
162 175
163 176 # create new environment.rb file
164 177 echo "RAILS_ROOT = '$CAFE_PATH/web'" > scripts/config/environment.rb
165 178 echo "GRADER_ROOT = '$CAFE_PATH/judge/scripts'" >> scripts/config/environment.rb
166 179 echo "require File.join(File.dirname(__FILE__),'../lib/boot')" >> scripts/config/environment.rb
167 180 echo "require File.dirname(__FILE__) + \"/env_#{GRADER_ENV}.rb\"" >> scripts/config/environment.rb
168 181
169 182 # compiling box
170 183 MACHINE_TYPE=`uname -m`
171 184 if [ ${MACHINE_TYPE} == 'x86_64' ]; then
172 185 gcc -std=c99 -o scripts/std-script/box scripts/std-script/box64-new.c
173 186 else
174 187 g++ -o scripts/std-script/box scripts/std-script/box.cc
175 188 fi
176 189
177 190
178 191 cd ..
179 192
180 193 echo "Now you are ready to run cafe grader...."
181 194 echo
182 195 echo "Try:"
183 196 echo
184 197 echo " cd web"
185 198 echo " rails s"
186 199 echo
187 200 echo "and access web at http://localhost:3000/"
188 201 echo "The root username is 'root', its password is 'ioionrails'."
189 202
You need to be logged in to leave comments. Login now