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 59c56ee585e28a5de100965a09090c778f08c2c6..3c1c4b2efd6a280ba0fc913fd85d6313dc3faae7 100644 (file)
@@ -9,3 +9,4 @@ git-daemon/inetd.conf
 git-daemon/git-daemon
 git-daemon/git-service
 git-daemon/sedscript
+git-daemon/logrotate
index 1a18f66dbafa9faceba604a2b646df0f4c9622b8..ad8dd782ec8cef4863cc874a92dd09c52195b149 100644 (file)
@@ -7,9 +7,16 @@
 
 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)
 
@@ -26,14 +33,17 @@ sedscript:  Makefile read-urlmap
                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
-               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)
index c66c61c38fbfe82fe6b699cf12ecb45ba585ae4d..bb4e847f64ab949de3b70870adea73c666ea78ec 100644 (file)
@@ -6,7 +6,7 @@
 
 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
index 11bf71759113bdf9e57f480750e4f4cb03d88cd8..f316fcca7374e83a6500424f2f9e7677b46f11bb 100644 (file)
@@ -1,2 +1,2 @@
 # 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
+}