diff options
author | Andrew Cady <d@jerkface.net> | 2020-09-04 22:57:21 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2020-09-04 22:57:21 -0400 |
commit | f2c10ace7e445cd6afd0617b90d7d155c5529e54 (patch) | |
tree | f0427b7db0037bba0471e5e21232aa92fdcabbd4 | |
parent | 49d5396c13ed821736a6ad49e1b3b2607c28b69c (diff) |
cgit support
-rw-r--r-- | selfpublish.sh | 65 |
1 files changed, 47 insertions, 18 deletions
diff --git a/selfpublish.sh b/selfpublish.sh index 9de446c..b2bb375 100644 --- a/selfpublish.sh +++ b/selfpublish.sh | |||
@@ -52,7 +52,7 @@ control_file() | |||
52 | cat <<EOF | 52 | cat <<EOF |
53 | Package: selfpublish-dot-sh-deps | 53 | Package: selfpublish-dot-sh-deps |
54 | Depends: apache2 (>= 2.4.46), libssl1.1 (>= 1.1.1d), | 54 | Depends: apache2 (>= 2.4.46), libssl1.1 (>= 1.1.1d), |
55 | fortune-mod, fortunes-min, curl | 55 | fortune-mod, fortunes-min, curl, cgit |
56 | Description: selfpublish.sh dependency package | 56 | Description: selfpublish.sh dependency package |
57 | This package depends on the dependencies of the | 57 | This package depends on the dependencies of the |
58 | selfpublish.sh script, and is installed by that | 58 | selfpublish.sh script, and is installed by that |
@@ -214,7 +214,7 @@ wait_for_certificate_issuance() | |||
214 | done | 214 | done |
215 | } | 215 | } |
216 | 216 | ||
217 | install_apache_site() | 217 | install_apache_vhost() |
218 | { | 218 | { |
219 | if [ -e "$SITE_CONF" ] && ! force | 219 | if [ -e "$SITE_CONF" ] && ! force |
220 | then | 220 | then |
@@ -248,6 +248,22 @@ install_self_to_site() | |||
248 | fi | 248 | fi |
249 | } | 249 | } |
250 | 250 | ||
251 | write_cgit_config() | ||
252 | { | ||
253 | cgit_scan_dir=$SITE_DIR/public_git/ | ||
254 | mkdir -p "$cgit_scan_dir" | ||
255 | line="scan-path=$cgit_scan_dir" | ||
256 | grep -xF "$line" /etc/cgitrc || printf '%s\n' "$line" >> /etc/cgitrc | ||
257 | } | ||
258 | |||
259 | configure_apache_vhost() | ||
260 | { | ||
261 | enable_apache_modules | ||
262 | install_self_to_site | ||
263 | install_header_to_site | ||
264 | write_cgit_config | ||
265 | } | ||
266 | |||
251 | install_header_to_site() | 267 | install_header_to_site() |
252 | { | 268 | { |
253 | cat > "$SITE_DIR"/public_html/HEADER.html <<EOF | 269 | cat > "$SITE_DIR"/public_html/HEADER.html <<EOF |
@@ -261,26 +277,40 @@ install_header_to_site() | |||
261 | </tr> | 277 | </tr> |
262 | <tr> | 278 | <tr> |
263 | <td> | 279 | <td> |
264 | <td style='border: 1px solid; padding: 6px;'> git repository: | 280 | <td style='padding: 6px;'> git repository: |
265 | <td style='padding: 6px'> <div style='font-size: 15px; padding: 1px;'> | 281 | <tr> |
282 | <td> | ||
283 | <td> | ||
284 | <td style='border: 1px solid; padding: 6px'> <div style='font-size: 15px; padding: 1px;'> | ||
266 | git clone ssh://d@cryptonomic.net:public_html/selfpublish.sh/<br> | 285 | git clone ssh://d@cryptonomic.net:public_html/selfpublish.sh/<br> |
267 | </div> | 286 | </div> |
268 | <tr> | 287 | <tr> |
269 | <td> | 288 | <td> |
270 | <td style='padding: 6px'> git repository browser: | 289 | <td style='padding: 6px;'> git repository browser: |
290 | <tr> | ||
291 | <td> | ||
292 | <td> | ||
271 | <td style='border: 1px solid; padding: 6px;'> <div style='font-size: 15px; padding: 1px;'> | 293 | <td style='border: 1px solid; padding: 6px;'> <div style='font-size: 15px; padding: 1px;'> |
272 | <a href="https://git.cryptonomic.net/selfpublish.sh"> | 294 | upstream: <a href="https://git.cryptonomic.net/selfpublish.sh"> |
273 | https://git.cryptonomic.net/selfpublish.sh/ | 295 | https://git.cryptonomic.net/selfpublish.sh/ |
274 | </a> </div> | 296 | </a> </div> |
275 | <tr> | 297 | <tr> |
276 | <td> | 298 | <td> |
277 | <td style='border: 1px solid; padding: 6px;'> this web server: | 299 | <td> |
278 | <td style='padding: 6px'> <div style='font-size: 15px; padding: 1px;'> | 300 | <td style='border: 1px solid; padding: 6px;'> <div style='font-size: 15px; padding: 1px;'> |
301 | local: <a href="git/selfpublish.sh"> | ||
302 | https://<!--#echo var="SERVER_NAME" -->/git/selfpublish.sh | ||
303 | </a> </div> | ||
304 | <tr> | ||
305 | <td> | ||
306 | <td style='padding: 6px;'> this web server: | ||
307 | <tr> | ||
308 | <td> | ||
309 | <td> | ||
310 | <td style='border: 1px solid; padding: 6px'> <div style='font-size: 15px; padding: 1px;'> | ||
279 | <a href="selfpublish.sh"> | 311 | <a href="selfpublish.sh"> |
280 | https://<!--#echo var="SERVER_NAME" -->/selfpublish.sh | 312 | https://<!--#echo var="SERVER_NAME" -->/selfpublish.sh |
281 | </a> </div> | 313 | </a> </div> |
282 | </td></tr> | ||
283 | </div> | ||
284 | </table> | 314 | </table> |
285 | </span> | 315 | </span> |
286 | </a> | 316 | </a> |
@@ -300,7 +330,7 @@ check_tls() | |||
300 | curl -s -S -I https://"$1" >/dev/null | 330 | curl -s -S -I https://"$1" >/dev/null |
301 | } | 331 | } |
302 | 332 | ||
303 | equivocate | 333 | [ "$NO_APT" ] || equivocate |
304 | 334 | ||
305 | APACHE_MODULES='status md rewrite ssl include cgi' | 335 | APACHE_MODULES='status md rewrite ssl include cgi' |
306 | APACHE_SITE_DIRS='logs public_html' | 336 | APACHE_SITE_DIRS='logs public_html' |
@@ -320,17 +350,16 @@ esac | |||
320 | 350 | ||
321 | if ! check_tls "$DOMAIN" || force | 351 | if ! check_tls "$DOMAIN" || force |
322 | then | 352 | then |
323 | equivocate | 353 | install_apache_vhost |
324 | enable_apache_modules | 354 | configure_apache_vhost |
325 | install_apache_site | 355 | |
326 | install_self_to_site | ||
327 | systemctl restart apache2 | 356 | systemctl restart apache2 |
328 | wait_for_certificate_issuance "$DOMAIN" | 357 | wait_for_certificate_issuance "$DOMAIN" |
329 | systemctl reload apache2 || systemctl restart apache2 | 358 | systemctl reload apache2 || systemctl restart apache2 |
330 | else | 359 | else |
331 | enable_apache_modules | 360 | install_apache_vhost |
332 | install_self_to_site | 361 | configure_apache_vhost |
333 | install_header_to_site | 362 | systemctl reload apache2 || systemctl restart apache2 |
334 | fi | 363 | fi |
335 | 364 | ||
336 | check_tls "$DOMAIN" | 365 | check_tls "$DOMAIN" |