|
@@ -88,4 +88,118 @@ function git_pull {
|
88
|
88
|
fi
|
89
|
89
|
}
|
90
|
90
|
|
|
91
|
+# This might be replaced in future with a separate rss reader script
|
|
92
|
+function rss_reader_modifications {
|
|
93
|
+ # modify the rss reader to use a socks5 proxy rather than a http proxy
|
|
94
|
+ if [ ! -d $RSS_READER_PATH ]; then
|
|
95
|
+ return
|
|
96
|
+ fi
|
|
97
|
+
|
|
98
|
+ # ensure that socks5 proxy is used
|
|
99
|
+ if ! grep -q "CURLOPT_PROXYTYPE" $RSS_READER_PATH/plugins/af_unburn/init.php; then
|
|
100
|
+ sed -i '/curl_setopt($ch, CURLOPT_PROXY, _CURL_HTTP_PROXY);/a \\t\t\t\t\tcurl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);' $RSS_READER_PATH/plugins/af_unburn/init.php
|
|
101
|
+ fi
|
|
102
|
+ if ! grep -q "CURLOPT_PROXYTYPE" $RSS_READER_PATH/include/functions.php; then
|
|
103
|
+ sed -i '/curl_setopt($ch, CURLOPT_PROXY, _CURL_HTTP_PROXY);/a \\t\t\t\tcurl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);' $RSS_READER_PATH/include/functions.php
|
|
104
|
+ fi
|
|
105
|
+ chown -R www-data:www-data $RSS_READER_PATH
|
|
106
|
+ chmod a+x $RSS_READER_PATH
|
|
107
|
+}
|
|
108
|
+
|
|
109
|
+# This ensures that a given repo is on a given commit
|
|
110
|
+# If it isn't then it attempts to upgrade
|
|
111
|
+function set_repo_commit {
|
|
112
|
+ repo_dir=$1
|
|
113
|
+ repo_commit_name=$2
|
|
114
|
+ repo_commit=$3
|
|
115
|
+ repo_url=$4
|
|
116
|
+ if [ -d $repo_dir ]; then
|
|
117
|
+ if grep -q "$repo_commit_name" $COMPLETION_FILE; then
|
|
118
|
+ CURRENT_REPO_COMMIT=$(grep "$repo_commit_name" $COMPLETION_FILE | awk -F ':' '{print $2}')
|
|
119
|
+ if [[ "$CURRENT_REPO_COMMIT" != "$repo_commit" ]]; then
|
|
120
|
+ cd $repo_dir
|
|
121
|
+ git_pull $repo_url $repo_commit
|
|
122
|
+
|
|
123
|
+ # application specific stuff after updating the repo
|
|
124
|
+ if [[ $repo_dir == *"www"* ]]; then
|
|
125
|
+ chown -R www-data:www-data $repo_dir
|
|
126
|
+ fi
|
|
127
|
+ if [[ $repo_dir == *"cjdns" ]]; then
|
|
128
|
+ ./do
|
|
129
|
+ fi
|
|
130
|
+ if [[ $repo_dir == *"tlsdate" ]]; then
|
|
131
|
+ cd $INSTALL_DIR/tlsdate
|
|
132
|
+ make clean
|
|
133
|
+ ./configure
|
|
134
|
+ if [ ! "$?" = "0" ]; then
|
|
135
|
+ echo $'Failed to configure tlsdate'
|
|
136
|
+ exit 727824
|
|
137
|
+ fi
|
|
138
|
+ make
|
|
139
|
+ if [ ! "$?" = "0" ]; then
|
|
140
|
+ echo $'Failed to build tlsdate'
|
|
141
|
+ exit 728752
|
|
142
|
+ fi
|
|
143
|
+ make install
|
|
144
|
+ fi
|
|
145
|
+ if [[ $repo_dir == *"gpgit" ]]; then
|
|
146
|
+ cp gpgit.pl /usr/bin/gpgit.pl
|
|
147
|
+ fi
|
|
148
|
+ if [[ $repo_dir == *"cleanup-maildir" ]]; then
|
|
149
|
+ cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
|
|
150
|
+ fi
|
|
151
|
+ if [[ $repo_dir == *"nginx_ensite" ]]; then
|
|
152
|
+ make install
|
|
153
|
+ fi
|
|
154
|
+ if [[ $repo_dir == *"gogs" ]]; then
|
|
155
|
+ git checkout master
|
|
156
|
+ go get -u ./...
|
|
157
|
+ if [ ! "$?" = "0" ]; then
|
|
158
|
+ echo $'Failed to get gogs'
|
|
159
|
+ exit 52792
|
|
160
|
+ fi
|
|
161
|
+ git checkout $repo_commit
|
|
162
|
+ go build
|
|
163
|
+ if [ ! "$?" = "0" ]; then
|
|
164
|
+ echo $'Failed to build gogs'
|
|
165
|
+ exit 36226
|
|
166
|
+ fi
|
|
167
|
+ systemctl restart gogs
|
|
168
|
+ fi
|
|
169
|
+ if [[ $repo_dir == *"toxcore" ]]; then
|
|
170
|
+ sed -i 's|ExecStart=.*|ExecStart=/usr/local/bin/tox-bootstrapd --config /etc/tox-bootstrapd.conf|g' $rootdir/etc/systemd/system/tox-bootstrapd.service
|
|
171
|
+ autoreconf -i
|
|
172
|
+ ./configure --enable-daemon
|
|
173
|
+ make
|
|
174
|
+ make install
|
|
175
|
+ systemctl daemon-reload
|
|
176
|
+ systemctl restart tox-bootstrapd.service
|
|
177
|
+ fi
|
|
178
|
+ if [[ $repo_dir == *"toxic" ]]; then
|
|
179
|
+ make
|
|
180
|
+ make install
|
|
181
|
+ fi
|
|
182
|
+ if [[ $repo_dir == $RSS_READER_PATH ]]; then
|
|
183
|
+ rss_reader_modifications
|
|
184
|
+ fi
|
|
185
|
+ if [[ $repo_dir == *"inadyn" ]]; then
|
|
186
|
+ ./configure
|
|
187
|
+ USE_OPENSSL=1 make
|
|
188
|
+ make install
|
|
189
|
+ systemctl restart inadyn
|
|
190
|
+ fi
|
|
191
|
+ if [[ $repo_dir == *"ipfs" ]]; then
|
|
192
|
+ chown -R git:git /home/git
|
|
193
|
+ systemctl restart ipfs
|
|
194
|
+ systemctl daemon-reload
|
|
195
|
+ fi
|
|
196
|
+
|
|
197
|
+ sed -i "s/${repo_commit_name}.*/${repo_commit_name}:$repo_commit/g" $COMPLETION_FILE
|
|
198
|
+ fi
|
|
199
|
+ else
|
|
200
|
+ echo "${repo_commit_name}:${repo_commit}" >> $COMPLETION_FILE
|
|
201
|
+ fi
|
|
202
|
+ fi
|
|
203
|
+}
|
|
204
|
+
|
91
|
205
|
# NOTE: deliberately no exit 0
|