chiark / gitweb /
Rotate the logfile
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 22 May 2010 18:26:06 +0000 (19:26 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 22 May 2010 18:26:06 +0000 (19:26 +0100)
.gitignore
git-daemon/Makefile
git-daemon/git-upload-pack.in
git-daemon/inetd.conf.in
git-daemon/logrotate.in [new file with mode: 0644]

index 59c56ee..3c1c4b2 100644 (file)
@@ -9,3 +9,4 @@ git-daemon/inetd.conf
 git-daemon/git-daemon
 git-daemon/git-service
 git-daemon/sedscript
 git-daemon/git-daemon
 git-daemon/git-service
 git-daemon/sedscript
+git-daemon/logrotate
index 1a18f66..ad8dd78 100644 (file)
@@ -7,9 +7,16 @@
 
 include ../settings.make
 
 
 include ../settings.make
 
-TARGETS=       git-upload-pack inetd.conf git-daemon git-service
+gituser=       git
+varloggit=     $(varlog)/git
 
 
-SUBSTVARS=     libuserv etcuserv varlog
+TARGETS=       git-upload-pack inetd.conf git-daemon git-service logrotate
+
+SUBSTVARS=     libuserv etcuserv varloggit gituser
+
+CONFIGS=       $(services)/git-upload-pack \
+               $(etcuserv)/git-urlmap \
+               $(etcdir)/logrotate.d/userv-git-daemon
 
 all:           $(TARGETS)
 
 
 all:           $(TARGETS)
 
@@ -26,14 +33,17 @@ sedscript:  Makefile read-urlmap
                mv -f $@.new $@
 
 install:       all
                mv -f $@.new $@
 
 install:       all
-               mkdir -p $(libuserv) $(etcuserv) $(services)
+               mkdir -p $(libuserv) $(etcuserv) $(services) \
+                       $(etcdir)/logrotate.d
+               install -d -o $(gituser) -g adm $(varloggit)
                cp git-daemon git-service $(libuserv)
                cp git-upload-pack $(services)/git-upload-pack:new
                cp git-urlmap $(etcuserv)/git-urlmap:new
                cp git-daemon git-service $(libuserv)
                cp git-upload-pack $(services)/git-upload-pack:new
                cp git-urlmap $(etcuserv)/git-urlmap:new
-               set -e; cd $(services); test -f git-upload-pack \
-                       || mv git-upload-pack:new git-upload-pack
-               set -e; cd $(etcuserv); test -f git-urlmap \
-                       || mv git-urlmap:new git-urlmap
+               cp logrotate $(etcdir)/logrotate.d/userv-git-daemon:new
+               set -e; for f in $(CONFIGS); do \
+                       if test -f $$f; then continue; fi; \
+                       mv $$f:new $$f; \
+               done
 
 clean:
                rm -f $(TARGETS)
 
 clean:
                rm -f $(TARGETS)
index c66c61c..bb4e847 100644 (file)
@@ -6,7 +6,7 @@
 
 if ( grep service-user-shell /etc/shells
    & glob service git-upload-pack
 
 if ( grep service-user-shell /etc/shells
    & glob service git-upload-pack
-   & glob calling-user git
+   & glob calling-user @gituser@
    )
         reset
        errors-to-syslog daemon error
    )
         reset
        errors-to-syslog daemon error
index 11bf717..f316fcc 100644 (file)
@@ -1,2 +1,2 @@
 # Example inetd.conf line for the userv git daemon.
 # Example inetd.conf line for the userv git daemon.
-git stream tcp nowait git /usr/sbin/tcpd @libuserv@/git-daemon -L@varlog@/git/userv-git-daemon.log @etcuserv@/git-urlmap
+git stream tcp nowait @gituser@ /usr/sbin/tcpd @libuserv@/git-daemon -L@varloggit@/userv-git-daemon.log @etcuserv@/git-urlmap
diff --git a/git-daemon/logrotate.in b/git-daemon/logrotate.in
new file mode 100644 (file)
index 0000000..06e0ef2
--- /dev/null
@@ -0,0 +1,6 @@
+@varloggit@/userv-git-daemon.log {
+       rotate 7
+       daily
+       missingok
+       delaycompress
+}