-
Notifications
You must be signed in to change notification settings - Fork 1
/
update-cloud9.php
213 lines (155 loc) · 9.3 KB
/
update-cloud9.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
// =========================================
// UPDATE-CLOUD9.PHP
// C9@ETF project (c) 2015-2020
//
// Software installation component
// Download and install Cloud9 and apply patches
// =========================================
require("lib/config.php");
// UPDATING Cloud9 INSTANCE IN c9upstream DIR
`rm -fr $conf_home_path/$conf_c9_user/.c9old`;
`rm -fr $conf_base_path/c9upstream`;
// Install Cloud9
echo `echo "\033[31mDownloading Cloud9 IDE\033[0m"`;
`git clone $cloud9_git_url $conf_base_path/c9upstream`;
echo "\n";
echo `echo "\033[31mInstalling Cloud9 IDE\033[0m"`;
`chown -R $conf_c9_user:$conf_c9_group $conf_base_path/c9upstream`;
`mv $conf_home_path/$conf_c9_user/.c9 $conf_home_path/$conf_c9_user/.c9old`;
`su $conf_c9_user -c $conf_base_path/c9upstream/scripts/install-sdk.sh`;
`chmod -R 755 $conf_base_path/c9upstream`; // ???? this is needed... but why?
// Make a backup of some file that randomly gets deleted (!?)
`cp $conf_base_path/c9upstream/node_modules/engine.io-client/engine.io.js $conf_base_path/c9util`;
// APPLY PATCHES
echo "\n";
echo `echo "\033[31mApplying patches\033[0m"`;
// Disable "keys" plugin which is confusing and uses screen real estate
echo "\ndisable_keys_plugin.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/disable_keys_plugin.diff`;
// Improve and translate Welcome screen
echo "\nfix_welcome_plugin.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/fix_welcome_plugin.diff`;
`cp patches/welcome-img/* c9upstream/plugins/c9.ide.welcome/images`;
// Disable "Open terminal here" and similar options
echo "\ndisable_open_terminal.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/disable_open_terminal.diff`;
// Disable "Process list" plugin that would enable users to kill eachothers processes
echo "\ndisable_processlist.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/disable_processlist.diff`;
// Disable "Command" widget that allows user to run arbitrary command on server
echo "\ndisable_command.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/disable_command.diff`;
// Disable "Show Home in Favorites" option (in tree) since students would
// accidentally enable it and then delete important files
echo "\ndisable_show_home_in_favorites.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/disable_show_home_in_favorites.diff`;
// Remove "Enable Auto-Save" from preferences but leave enabled
echo "\nautosave_default.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/autosave_default.diff`;
// Additional C/C++ snippets by cyclone
echo "\nc_cpp_snippets.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/c_cpp_snippets.diff`;
// Add C, C++ and Java to "New From Template" menu
echo "\nc_cpp_java_templates.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/c_cpp_java_templates.diff`;
// Source code formatting for C, C++ and Java using Astyle
// FIXME: Currently implemented through a web service - move to c9 api
echo "\nformatter_astyle.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/formatter_astyle.diff`;
// By default tmux binary creates a socket in /tmp (owned by user)... this
// sometimes caused permission errors when another user tried to run program.
// This patch creates a separate tmux socket file for each user
echo "\ntmux_socket_error.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/tmux_socket_error.diff`;
// Detect when user is logged out and redirect to login page, instead of just
// displaying "Reconnecting" forever (maybe localize?)
echo "\ndetect_logout.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/detect_logout.diff`;
// Fix bug where user settings were reverted to default after each login
echo "\nfix_forget_settings.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/fix_forget_settings.diff`;
// "Run" button would sometimes get stuck in disabled state
echo "\nfix_stuck_run_button.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/fix_stuck_run_button.diff`;
// Avoid inconsequential ENOENT error message that watch file had dissapeared
echo "\nfix_useless_error.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/fix_useless_error.diff`;
// Fix erroneous error message "No error" that showed up after using gdb
echo "\nfix_gdb_no_error.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/fix_gdb_no_error.diff`;
// Due to poor handling of undefined value, "debug" button would sometimes
// automatically reenable instead of staying disabled
echo "\ndebugging_default_to_false.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/debugging_default_to_false.diff`;
// Support for evaluating vectors and their elements in gdb debugger
// (see http://stackoverflow.com/questions/253099/how-do-i-print-the-elements-of-a-c-vector-in-gdb)
echo "\ngdb_evaluate_vectors_elements.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_evaluate_vectors_elements.diff`;
// Debugging the debugger is painful due to async file writes - this fixes it at the cost of
// performance (we're not always debugging the debugger)
// Also log file is stored in users workspace and timestamp added
//echo "gdb_sync_log.diff\n";
//echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_sync_log.diff`;
// Don't crash debugger when there is open brace (but not closed!) inside string
// Also some warnings
//echo "gdb_fix_brace_inside_string.diff\n";
//echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_fix_brace_inside_string.diff`;
// Make sure truncated packages (sometimes returned by gdb) are valid JSON
// Such packages sometimes caused crashes
//echo "gdb_fix_truncated_package.diff\n";
//echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_fix_truncated_package.diff`;
// Properly escape octal numbers in gdb output (also sometimes causing crashes)
//echo "gdb_fix_escaping_octal_numbers.diff\n";
//echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_fix_escaping_octal_numbers.diff`;
// Cleanup some warnings thrown by nodejs in gdb shim code, add some more debugging
//echo "gdb_warnings_debugging.diff\n";
//echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/gdb_warnings_debugging.diff`;
// Patches that failed to port:
// - parse_program_output.diff is currently considered obsolete, but it's the only way to detect if program run too long
// - gdb prevent infinite recursion, e.g. with evaluating C++ string object on stack
// - gdb evaluate C++ vector object on stack
// - gdb limit number of children fetched to prevent slowness/crashes with oversized response package
// Use relative paths instead of absolute (so that e.g. http://hostname/user/ redirects to
// http://hostname/user/ide.html and not http://hostname/ide.html)
echo "\nrelative_paths.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/relative_paths.diff`;
// Fix "Logout" and other actions in user menu to use c9@etf infrastructure instead of c9.io
echo "\nuser_menu.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/user_menu.diff`;
// Display a progress bar that corresponds to actual files being loaded
echo "\nprogress_bar.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/progress_bar.diff`;
// Remove some obsolete loading messages
echo "\nobsolete_messages.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/obsolete_messages.diff`;
// Retry loading a failed file instead of just die
echo "\nretry_failed.diff\n";
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/retry_failed.diff`;
// Install ETF plugins - we need nginx to route to these
echo "\n";
echo `echo "\033[31mInstall ETF plugins\033[0m"`;
echo "etf.annotate\n";
`cp -R $conf_base_path/plugins/etf.annotate $conf_base_path/c9upstream/plugins`;
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/etf_annotate.diff`;
echo "etf.buildservice\n";
`cp -R $conf_base_path/plugins/etf.buildservice $conf_base_path/c9upstream/plugins`;
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/etf_buildservice.diff`;
echo "etf.zadaci\n";
`cp -R $conf_base_path/plugins/etf.zadaci $conf_base_path/c9upstream/plugins`;
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/etf_zadaci.diff`;
echo "etf.zamger\n";
`cp -R $conf_base_path/plugins/etf.zamger $conf_base_path/c9upstream/plugins`;
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/etf_zamger.diff`;
echo "etf.help\n";
`cp -R $conf_base_path/plugins/etf.help $conf_base_path/c9upstream/plugins`;
echo `cd $conf_base_path/c9upstream; patch -p1 < ../patches/etf_help.diff`;
// Disable some runners: all C and C++ runners (we provide our own) and Shell command runners
`mkdir $conf_base_path/c9upstream/runners.disabled`;
`mv $conf_base_path/c9upstream/plugins/c9.ide.run/runners/C\ * $conf_base_path/c9upstream/runners.disabled`;
`mv $conf_base_path/c9upstream/plugins/c9.ide.run/runners/C\+\+* $conf_base_path/c9upstream/runners.disabled`;
`mv $conf_base_path/c9upstream/plugins/c9.ide.run/runners/Shell* $conf_base_path/c9upstream/runners.disabled`;
`rm $conf_base_path/c9upstream/plugins/c9.ide.run/runners-docker/C\ *`;
`rm $conf_base_path/c9upstream/plugins/c9.ide.run/runners-docker/C\+\+*`;
`rm $conf_base_path/c9upstream/plugins/c9.ide.run/runners-docker/Shell*`;
?>