@@ -23,6 +23,7 @@ checkoutdir="${workdir}/${reponame}"
23
23
resourcedir=" ${workdir} /magical-pony"
24
24
statusfile=' /var/www/html/index.html'
25
25
certbotargs=' -w /var/www/html -d legal.creativecommons.org'
26
+ no_errors=1
26
27
27
28
rm -rf " ${checkoutdir} "
28
29
@@ -120,6 +121,10 @@ echo ' <h2 class="clear">Branches</h2>' >> "${statusfile}"
120
121
121
122
for branchname in $( git branch -r | grep -v ' HEAD\|main' )
122
123
do
124
+ if [[ " ${branchname} " == ' origin/staging' ]]
125
+ then
126
+ continue
127
+ fi
123
128
echo " # ${branchname} "
124
129
branchid=" ${branchname##*/ } "
125
130
if [[ -n " ${branchid// [-.[:alnum:]]/ } " ]]
@@ -200,16 +205,19 @@ echo
200
205
echo ' # apache2 restart'
201
206
/usr/sbin/service apache2 restart
202
207
sleep 1
208
+ echo
203
209
204
210
echo
205
211
echo ' # cerbotargs:'
206
212
echo " ${certbotargs} "
213
+ echo
214
+
207
215
echo
208
216
echo ' # run cerbot'
209
217
echo
210
218
# Get any new certificates, incorporate old one, refresh expiring, install any
211
219
# new http->https redirects, and do so automatically.
212
- if /usr /bin/certbot \
220
+ if /snap /bin/certbot \
213
221
--agree-tos -m webmaster@creativecommons.org \
214
222
--non-interactive \
215
223
--cert-name legal.creativecommons.org \
@@ -222,8 +230,10 @@ if /usr/bin/certbot \
222
230
then
223
231
echo ' <h2>And we are done!</h2>' >> " ${statusfile} "
224
232
else
233
+ es=${?}
234
+ no_errors=0
225
235
{
226
- echo ' <h2>certbot ERROR</ h2>'
236
+ echo " <h2>certbot ERROR (exit status <code> ${es} </code>)</ h2>"
227
237
echo ' <p>See:'
228
238
echo ' <pre>/var/log/letsencrypt/letsencrypt.log</pre>'
229
239
echo ' <pre>/var/log/magical-pony</pre>'
261
271
echo ' # apache2 restart'
262
272
/usr/sbin/service apache2 restart
263
273
264
- sed -e' s/"run-error"/"run-success"/' -i " ${statusfile} "
274
+ if [[ ${no_errors} == 1 ]]
275
+ then
276
+ sed -e' s/"run-error"/"run-success"/' -i " ${statusfile} "
277
+ fi
0 commit comments