Date: Sun, 29 May 2005 05:24:48 +0900 (JST) From: KIMURA Yasuhiro <yasu@utahime.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/81598: [PATCH] net/cvsup-mirror: add some install time options for update.sh Message-ID: <20050528202448.E40DA54B4@eastasia.home.utahime.org> Resent-Message-ID: <200505282030.j4SKU9TN078038@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 81598 >Category: ports >Synopsis: [PATCH] net/cvsup-mirror: add some install time options for update.sh >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat May 28 20:30:08 GMT 2005 >Closed-Date: >Last-Modified: >Originator: KIMURA Yasuhiro >Release: FreeBSD 4.11-RELEASE-p9 i386 >Organization: >Environment: System: FreeBSD xxxx 4.11-RELEASE-p9 FreeBSD 4.11-RELEASE-p9 #0: Sat May 14 11:16:09 JST 2005 xxxx i386 >Description: Add following install time options for update.sh - Whether or not /var/log/cvsup.log is rotated when update.sh is invoked. - Maximum number of log files. - Wheter or not old log file is gzipped after rotated. >How-To-Repeat: >Fix: --- patch-cvsup-mirror begins here --- Index: Makefile =================================================================== RCS file: /net/freebsd/cvsroot/ports/net/cvsup-mirror/Makefile,v retrieving revision 1.21 diff -u -r1.21 Makefile --- Makefile 5 Aug 2004 23:37:47 -0000 1.21 +++ Makefile 28 May 2005 19:19:54 -0000 @@ -7,7 +7,7 @@ PORTNAME= cvsup-mirror PORTVERSION= 1.3 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net DISTFILES= Index: files/update.sh =================================================================== RCS file: /net/freebsd/cvsroot/ports/net/cvsup-mirror/files/update.sh,v retrieving revision 1.17 diff -u -r1.17 update.sh --- files/update.sh 5 Aug 2004 23:37:47 -0000 1.17 +++ files/update.sh 28 May 2005 19:35:55 -0000 @@ -11,26 +11,27 @@ lock=/var/spool/lock/cvsup.lock log=/var/log/cvsup.log +base=${PREFIX}/etc/cvsup -num_logs=8 -use_gzip=0 +. ${base}/config.sh || exit -if [ ${use_gzip} != 0 ] -then - gz_ext=.gz -fi +umask 22 -# Rotate the log files +if [ ${rotatelog} != 0 ]; then -umask 22 + if [ ${gziplog} != 0 ]; then + gz_ext=.gz + fi -for i in $(/usr/bin/jot ${num_logs} $((${num_logs}-1)) 0) -do + # Rotate the log files + for i in $(/usr/bin/jot ${numlogs} $((${numlogs}-1)) 0) + do test -f ${log}.$i${gz_ext} && mv -f ${log}.$i${gz_ext} ${log}.$(($i+1))${gz_ext} -done + done + test -f ${log} && mv -f ${log} ${log}.0 && [ ${gziplog} != 0 ] && gzip -9 ${log}.0 +fi -test -f ${log} && mv -f ${log} ${log}.0 && [ ${use_gzip} != 0 ] && /usr/bin/gzip -9 ${log}.0 -exec >${log} 2>&1 +exec >>${log} 2>&1 # Do the update Index: scripts/configure =================================================================== RCS file: /net/freebsd/cvsroot/ports/net/cvsup-mirror/scripts/configure,v retrieving revision 1.8 diff -u -r1.8 configure --- scripts/configure 9 Jul 2000 17:57:33 -0000 1.8 +++ scripts/configure 28 May 2005 19:18:22 -0000 @@ -2,7 +2,7 @@ base=${PREFIX}/etc/cvsup variables="user group cuser cgroup host interval \ - maxclients facility distribs" + maxclients facility distribs rotatelog numlogs gziplog" ask() { local question default answer @@ -174,6 +174,50 @@ echo "Please answer with a number" done +cat <<EOF + +All outputs of CVSup client are logged in /var/log/cvsup.log. You can +make update script rotate the log file(s) when it is call, if you wich. +Otherwise outputs are simply appended. + +EOF + +if yesno "Do you wish to make update script rotate the log file(s)" y; then + rotatelog=1 + + cat <<EOF + +You can limit the number of log file. If exceeded, the oldest one is removed. + +EOF + + while :; do + numlogs=$(ask "Maximum number of log file(s)" 8) + if expr "${numlogs}" : "[1-9][0-9]*\$" >/dev/null 2>&1; then + break + fi + echo "Please answer with a positive integer" + done + + cat <<EOF + +You can gzip the old log file to save disk space when log files are rotated, +if you wish. + +EOF + + if yesno "Do you wish to gzip the old log file(s)" n; then + gziplog=1 + else + gziplog=0 + fi + +else + rotatelog=0 + numlogs=0 + gziplog=0 +fi + #------------------------------------------------------------------------------ echo "" --- patch-cvsup-mirror ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050528202448.E40DA54B4>