OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src openpkg-web Date: 28-Jul-2003 15:45:05
Branch: HEAD Handle: 2003072814445905
Added files:
openpkg-src/nntpcache nntpcache.patch
Modified files:
openpkg-src/nntpcache nntpcache.spec rc.nntpcache
openpkg-web news.txt
Log:
%status; major rc and spec (un)install scriptlet improvments; patch to
handle pid files; fsl LOG_NEWS issue; log rotation; daemon bind
Summary:
Revision Changes Path
1.1 +54 -0 openpkg-src/nntpcache/nntpcache.patch
1.37 +37 -4 openpkg-src/nntpcache/nntpcache.spec
1.7 +42 -2 openpkg-src/nntpcache/rc.nntpcache
1.5869 +1 -0 openpkg-web/news.txt
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/nntpcache/nntpcache.patch
============================================================================
$ cvs diff -u -r0 -r1.1 nntpcache.patch
--- /dev/null 2003-07-28 15:45:04.000000000 +0200
+++ nntpcache.patch 2003-07-28 15:45:04.000000000 +0200
@@ -0,0 +1,54 @@
+--- src/nntpcache.c.orig 2002-04-05 20:29:58.000000000 +0200
++++ src/nntpcache.c 2003-07-28 14:02:21.000000000 +0200
+@@ -1247,7 +1247,12 @@
+ Task = task_info_new (nc_master, "master");
+ watchInit();
+ drop_priv(ncUID, ncGID);
+- sprintf (PidFile, "%.127s.%.164s", con->pidFile, con->bindAddr);
++
++ if (strchr(con->pidFile, (int)'/') != NULL)
++ sprintf (PidFile, "%.127s", con->pidFile);
++ else
++ sprintf (PidFile, "%.127s.%.164s", con->pidFile, con->bindAddr);
++
+ if (!(fh = fopen (PidFile, "w")))
+ logw (("couldn't open pid file '%s'", PidFile));
+ else
+@@ -1436,6 +1441,7 @@
+ char *config_file = con->configFile;
+ char *access_file = con->accessFile;
+ char *bindAddr = NULL;
++ char *pidFile = NULL;
+ struct hostent *hp;
+ enum task_state task;
+ char *p = NULL;
+@@ -1456,7 +1462,7 @@
+ assert(task_desc[nc_last] == NULL);
+ task = nc_master;
+
+- while ((c = getopt (argc, argv, "ef:hnb:rc:s")) != -1)
++ while ((c = getopt (argc, argv, "ef:hnb:p:rc:s")) != -1)
+ switch (c)
+ {
+ case 'a':
+@@ -1496,6 +1502,9 @@
+ case 'b':
+ bindAddr = Sstrdup(optarg);
+ break;
++ case 'p':
++ pidFile = Sstrdup(optarg);
++ break;
+ case 's':
+ SwapWithChild = TRUE;
+ break;
+@@ -1563,6 +1572,10 @@
+ if (con->bindAddr) free(con->bindAddr);
+ con->bindAddr = Sstrdup(bindAddr);
+ }
++ if (pidFile) {
++ if (con->pidFile) free(con->pidFile);
++ con->pidFile = Sstrdup(pidFile);
++ }
+ if (chdir (con->configDir) == -1)
+ {
+ loge (("couldn't set cwd to %s", con->configDir));
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/nntpcache/nntpcache.spec
============================================================================
$ cvs diff -u -r1.36 -r1.37 nntpcache.spec
--- openpkg-src/nntpcache/nntpcache.spec 23 Jul 2003 13:32:06 -0000 1.36
+++ openpkg-src/nntpcache/nntpcache.spec 28 Jul 2003 13:45:04 -0000 1.37
@@ -23,6 +23,8 @@
## SUCH DAMAGE.
##
+# FIXME: send-mail -i [EMAIL PROTECTED]; tracked down to nntpcache-gdb.sh
+
# package information
Name: nntpcache
Summary: NNTP Caching Proxy
@@ -33,7 +35,7 @@
Group: News
License: BSD
Version: 3.0.1
-Release: 20030723
+Release: 20030728
# package options
%option with_fsl yes
@@ -42,6 +44,7 @@
Source0: ftp://ftp.nntpcache.org/pub/nntpcache/nntpcache-%{version}.tar.gz
Source1: rc.nntpcache
Source2: fsl.nntpcache
+Patch0: nntpcache.patch
# build information
Prefix: %{l_prefix}
@@ -68,6 +71,12 @@
%prep
%setup -q
+ %patch -p0
+%if "%{with_fsl}" == "yes"
+ %{l_shtool} subst \
+ -e 's;\(openlog.*\)LOG_NEWS\(.*\);\1LOG_USER\2;' \
+ src/nntpcache.c
+%endif
%build
# configure package
@@ -77,15 +86,26 @@
%{l_shtool} subst \
-e 's;/etc/nntpcache/\(newshound\.conf\);%{l_prefix}/etc/nntpcache/\1;' \
contrib/newshound/getconf.c
+ %{l_shtool} subst -s \
+ -e 's;^\(pidFile .*\);#\1 ;' \
+ -e 's;^\(adminEmail \).*;\1 [EMAIL PROTECTED];' \
+ -e 's;^/usr/local/\(etc|var.*\);%{l_prefix}/\1;' \
+ cf/nntpcache.config-dist
+
+ (
+ echo "nc_cv_UID=%{l_musr}"
+ echo "nc_cv_GID=%{l_rgrp}"
+ ) >config.cache
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
LDFLAGS="%{l_fsl_ldflags}" \
LIBS="%{l_fsl_libs}" \
./configure \
+ --cache-file=./config.cache \
--prefix=%{l_prefix} \
- --sysconfdir=%{l_prefix}/etc/nntpcache \
- --libexecdir=%{l_prefix}/libexec/nntpcache \
- --localstatedir=%{l_prefix}/var/nntpcache
+ --sysconfdir=%{l_prefix}/etc \
+ --libexecdir=%{l_prefix}/libexec \
+ --localstatedir=%{l_prefix}/var
# build package
%{l_make} %{l_mflags}
@@ -149,4 +169,17 @@
%clean
rm -rf $RPM_BUILD_ROOT
+
+%post
+ # after upgrade, restart service
+ [ $1 -eq 2 ] || exit 0
+ eval `%{l_rc} nntpcache status 2>/dev/null`
+ [ ".$nntpcache_active" = .yes ] && %{l_rc} nntpcache restart
+ exit 0
+
+%preun
+ # before erase, stop service
+ [ $1 -eq 0 ] || exit 0
+ %{l_rc} nntpcache stop 2>/dev/null
+ exit 0
@@ .
patch -p0 <<'@@ .'
Index: openpkg-src/nntpcache/rc.nntpcache
============================================================================
$ cvs diff -u -r1.6 -r1.7 rc.nntpcache
--- openpkg-src/nntpcache/rc.nntpcache 21 Jul 2003 08:12:39 -0000 1.6
+++ openpkg-src/nntpcache/rc.nntpcache 28 Jul 2003 13:45:04 -0000 1.7
@@ -5,20 +5,60 @@
%config
nntpcache_enable="$openpkg_rc_def"
+ nntpcache_bind="127.0.0.1"
+ nntpcache_port="119"
nntpcache_log_prolog="true"
nntpcache_log_epilog="true"
nntpcache_log_numfiles="10"
nntpcache_log_minsize="1M"
nntpcache_log_complevel="9"
+%common
+ nntpcache_pidfile="@l_prefix@/var/nntpcache/nntpcache.pid"
+ nntpcache_signal () {
+ [ -f $nntpcache_pidfile ] && kill -$1 `cat $nntpcache_pidfile`
+ }
+ nntpcache_start () {
+ @l_prefix@/sbin/nntpcached \
+ -b ${nntpcache_bind:-DEFAULT}:${nntpcache_port:-nntp} \
+ -p $nntpcache_pidfile
+ }
+ nntpcache_stop () {
+ nntpcache_signal TERM
+ }
+
+%status -u root -o
+ nntpcache_usable="unknown"
+ nntpcache_active="no"
+ rcService nntpcache enable yes && \
+ nntpcache_signal 0 && nntpcache_active="yes"
+ echo "nntpcache_enable=\"$nntpcache_enable\""
+ echo "nntpcache_usable=\"$nntpcache_usable\""
+ echo "nntpcache_active=\"$nntpcache_active\""
+
+%start -u @l_susr@
+ rcService nntpcache enable yes || exit 0
+ rcService nntpcache active yes && exit 0
+ nntpcache_start
+
+%stop -u @l_susr@
+ rcService nntpcache enable yes || exit 0
+ rcService nntpcache active no && exit 0
+ nntpcache_stop
+
+%restart -u @l_susr@
+ rcService nntpcache enable yes || exit 0
+ rcService nntpcache active no && exit 0
+ rc nntpcache stop start
+
%daily -u @l_susr@
rcService nntpcache enable yes || exit 0
# rotate logfile
shtool rotate -f \
-n ${nntpcache_log_numfiles} -s ${nntpcache_log_minsize} -d \
- -z ${nntpcache_log_complevel} -o @l_rusr@ -g @l_rgrp@ -m 644 \
+ -z ${nntpcache_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \
-P "${nntpcache_log_prolog}" \
- -E "${nntpcache_log_epilog}" \
+ -E "${nntpcache_log_epilog} && rc nntpcache restart" \
@l_prefix@/var/nntpcache/nntpcache.log
@@ .
patch -p0 <<'@@ .'
Index: openpkg-web/news.txt
============================================================================
$ cvs diff -u -r1.5868 -r1.5869 news.txt
--- openpkg-web/news.txt 28 Jul 2003 13:37:07 -0000 1.5868
+++ openpkg-web/news.txt 28 Jul 2003 13:44:59 -0000 1.5869
@@ -1,3 +1,4 @@
+28-Jul-2003: Upgraded package: P<nntpcache-3.0.1-20030728>
28-Jul-2003: Upgraded package: P<samhain-1.7.10-20030728>
28-Jul-2003: Upgraded package: P<php-4.3.2-1.20030728>
28-Jul-2003: Upgraded package: P<gpp-2.1-1.20030728>
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]