chiark / gitweb /
Rotate the logfile
[userv-utils.git] / git-daemon / Makefile
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)