various fixes and improvements
[distro-setup] / homepage-setup
index 091a50ac1e95ae98cdc86e666449d73c00c8d6ca..bea012657ec35109461fff669ad1735c523b8831 100755 (executable)
@@ -2,36 +2,49 @@
 # Copyright (C) 2016 Ian Kelling
 # This program is under GPL v. 3 or later, see <http://www.gnu.org/licenses/>
 
-# lj is test server
-case $HOSTNAME in
-    lj)
-        domain=iankelling.org
-        ;;
-    lk)
-        domain=iank.bid
-        ;;
-esac
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
+domain=$1
+
+if [[ ! $1 ]]; then
+    echo "$0: error: expected domain argument"
+    exit 1
+fi
+
+gitroot=/a/bin/githtml
+
+type -P a2enmod &>/dev/null || pi apache2
+
+acme-tiny-wrapper $domain
 
 # debian has the package gitweb, which seems to mainly
 # have some example apache config, and a minimal gitweb config.
 # I'll just use the config as example and not use the package.
 # It's example apache config seems to say we can use cgi or cgid,
 # and googling cgid it seems a newer faster alternative.
-s a2enmod cgid
+sudo a2enmod cgid
 
+# so, highlight is not highlighting my
+pi highlight
+
+# additional settings from browsing https://git-scm.com/docs/gitweb.conf
 s dd of=/etc/gitweb.conf <<EOF
-\$projectroot = "$gitroot";
+\$feature{'highlight'}{'default'} = [1];
+# highlighting doesn't work on files without extension.
+# I noticed in terminal "highlight file" won't do it (unknown file type)
+# hightlight < file will do it, and it's online documentation
+# suggests it reads shebang. Todo: file a bug for gitweb
+# to make highlight read shebangs.
+our \$projectroot = "$gitroot";
 # not documented at https://git-scm.com/docs/gitweb.conf,
 # but it's in the debian conf, so use it.
 # directory to use for temp files.
 \$git_temp = "/tmp";
+push @git_base_url_list, "https://$domain/git";
 EOF
 
 
-git_root=/a/bin/githtml
-
-
 apache-site - $domain <<EOF
 # to run python script on my site:
 <Directory /var/www/$domain/html>