src.nth.io/

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git/web/tasks/main.yaml36
-rw-r--r--git/web/templates/cgit.nginx.conf.j25
-rw-r--r--git/web/templates/cgitrc.j214
-rw-r--r--nginx/tasks/main.yaml5
4 files changed, 45 insertions, 15 deletions
diff --git a/git/web/tasks/main.yaml b/git/web/tasks/main.yaml
index 58a2005..1d07e2f 100644
--- a/git/web/tasks/main.yaml
+++ b/git/web/tasks/main.yaml
@@ -15,19 +15,39 @@
template: src="cgitrc.j2" dest="/etc/cgitrc"
notify: restart fcgiwrap
-- name: install cgit nginx site
+- name: make /etc/cgit dir
become: yes
- template: src="cgit.nginx.conf.j2" dest="/etc/nginx/sites-available/cgit.conf"
- notify: restart nginx
+ file: path="/etc/cgit" state="directory"
+ when: cgit_header_src is defined or cgit_footer_src is defined
-- name: enable cgit nginx site
+- name: install cgit custom css
become: yes
- file:
- src: "/etc/nginx/sites-available/cgit.conf"
- dest: "/etc/nginx/sites-enabled/cgit.conf"
- state: "link"
+ copy: src="{{cgit_css_src}}" dest="/usr/share/cgit/cgit-custom.css"
+ when: cgit_css_src is defined
notify: restart nginx
+- name: install cgit header
+ become: yes
+ copy: src="{{cgit_header_src}}" dest="/etc/cgit/header.html"
+ when: cgit_header_src is defined
+ notify: restart fcgiwrap
+
+- name: install cgit footer
+ become: yes
+ copy: src="{{cgit_footer_src}}" dest="/etc/cgit/footer.html"
+ when: cgit_footer_src is defined
+ notify: restart fcgiwrap
+
+- name: set cgit repo owners
+ become: yes
+ shell: |
+ find {{cgit_scan_path}} -maxdepth 2 -name HEAD -type f | while read headfile; do
+ repodir=$(dirname "$headfile")
+ git config --file "${repodir}/config" gitweb.owner "{{cgit_owner}}"
+ done
+ when: cgit_owner is defined
+ changed_when: true
+
- name: ensure fcgiwrap service is started
become: yes
systemd: name="fcgiwrap.service" enabled="yes" state="started"
diff --git a/git/web/templates/cgit.nginx.conf.j2 b/git/web/templates/cgit.nginx.conf.j2
index 324dd0c..0ddbe38 100644
--- a/git/web/templates/cgit.nginx.conf.j2
+++ b/git/web/templates/cgit.nginx.conf.j2
@@ -25,11 +25,6 @@ server {
root /usr/share/cgit;
- # Redirect old Mercurial-style paths to cgit equivalents
- rewrite ^/([^/]+)/file/tip/(.*)$ /$1/tree/$2 permanent;
- rewrite ^/([^/]+)/file/tip$ /$1/tree permanent;
- rewrite ^/([^/]+)/file$ /$1/tree permanent;
-
try_files $uri @cgit;
location @cgit {
diff --git a/git/web/templates/cgitrc.j2 b/git/web/templates/cgitrc.j2
index 76a91d6..6e8df0c 100644
--- a/git/web/templates/cgitrc.j2
+++ b/git/web/templates/cgitrc.j2
@@ -1,12 +1,22 @@
-scan-path={{cgit_scan_path}}
remove-suffix=1
virtual-root=/
root-title={{cgit_root_title}}
root-desc={{cgit_root_desc}}
+{% if cgit_css_src is defined %}
+css=/cgit-custom.css
+{% endif %}
+{% if cgit_header_src is defined %}
+header=/etc/cgit/header.html
+{% endif %}
+{% if cgit_footer_src is defined %}
+footer=/etc/cgit/footer.html
+{% endif %}
+
difftype=ssdiff
+enable-git-config=1
enable-http-clone=1
enable-index-links=1
enable-log-filecount=1
@@ -14,3 +24,5 @@ enable-log-linecount=1
source-filter=/usr/lib/cgit/filters/syntax-highlighting.py
about-filter=/usr/lib/cgit/filters/about-formatting.sh
+
+scan-path={{cgit_scan_path}}
diff --git a/nginx/tasks/main.yaml b/nginx/tasks/main.yaml
index 1cc029c..1fe383a 100644
--- a/nginx/tasks/main.yaml
+++ b/nginx/tasks/main.yaml
@@ -41,7 +41,10 @@
- name: copy root files
become: yes
- synchronize: src="{{nginx_root_src}}" dest="{{nginx_root_dest}}/"
+ synchronize:
+ src: "{{nginx_root_src}}"
+ dest: "{{nginx_root_dest}}/"
+ checksum: yes
when: nginx_root
- name: enable nginx service