#!/bin/sh : ${git_public_fqdn:="$fqdn"} : ${git_basic_auth:='on'} : ${gitolite_username:='s-gitolite'} : ${gitolite_access_role:='gitolite-access'} : ${gitolite_admin_role:='gitolite-admin'} : ${cgit_clone_urls:="https://${fqdn} ssh://git@${fqdn}"} : ${cgit_root_title:="${site} Git Repo"} : ${cgit_root_desc:="Source code for various ${site} projects."} : ${cgit_pygments_style:='default'} : ${cgit_cache_size:='16000'} gitolite_dn="uid=${gitolite_username},${robots_basedn}" git_keytab="${keytab_dir}/nginx.keytab" git_https_cert="${nginx_conf_dir}/git.crt" git_https_key="${nginx_conf_dir}/git.key" gitolite_home=/usr/local/git gitolite_client_keytab="${keytab_dir}/gitolite.client.keytab" gitolite_fcgiwrap_socket=/var/run/fcgiwrap/gitolite.sock cgit_cache_dir=/var/cache/cgit cgit_fcgiwrap_socket=/var/run/fcgiwrap/cgit.sock cgit_webroot=/usr/local/www/cgit # Install packages. pkg install -y \ python \ nginx \ cgit \ gitolite \ fcgiwrap \ ca_root_nss \ py${python_version}-pygments \ py${python_version}-docutils \ py${python_version}-markdown # Create ZFS dataset for gitolite repositories. create_dataset -o "mountpoint=${gitolite_home}" "${state_dataset}/git" zfs set \ com.sun:auto-snapshot:hourly=true \ com.sun:auto-snapshot:daily=true \ com.sun:auto-snapshot:weekly=true \ com.sun:auto-snapshot:monthly=true \ "${state_dataset}/git" # Set ownership on gitolite dataset. install_directory -o "$gitolite_local_user" -g "$gitolite_local_user" -m 0700 "$gitolite_home" # Add www user to git group, so it can read git repositories. pw groupmod "$gitolite_local_user" -m "$nginx_user" # Create gitolite principal and keytab. ldap_add "$gitolite_dn" <