Browse Source

Remove logging replacement hack, add FSL binding, implement features in ticket #202

master
Michael Schloh von Bennewitz 23 years ago committed by Ralf S. Engelschall
parent
commit
4c037fde35
  1. 16
      msntp/fsl.msntp
  2. 12
      msntp/msntp.patch
  3. 63
      msntp/msntp.spec
  4. 58
      msntp/rc.msntp

16
msntp/fsl.msntp

@ -0,0 +1,16 @@
##
## fsl.msntp -- OSSP fsl configuration
##
ident (msntp)/.+ q{
prefix(
prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
)
-> {
debug: file(
path="@l_prefix@/var/msntp/msntp.log",
perm=0644
)
}
};

12
msntp/msntp.patch

@ -0,0 +1,12 @@
diff -Naur msntp-1.6.orig/unix.c msntp-1.6/unix.c
--- msntp-1.6.orig/unix.c 2003-08-28 17:48:15.000000000 +0200
+++ msntp-1.6/unix.c 2003-08-28 17:49:46.000000000 +0200
@@ -81,5 +81,7 @@
/* Log a message, crudely. This is used in only one place, but could
be used more widely. */
- syslog(LOG_DAEMON|LOG_WARNING,"%s",message);
+ openlog("msntp", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ syslog(LOG_WARNING,"%s",message);
+ closelog();
}

63
msntp/msntp.spec

@ -33,16 +33,26 @@ Distribution: OpenPKG [PLUS]
Group: Network
License: OSS-style
Version: 1.6
Release: 20030703
Release: 20030828
# package options
%option with_fsl yes
# list of sources
Source0: http://www.hpcf.cam.ac.uk/export/msntp-%{version}.tar.gz
Source1: rc.msntp
Source2: fsl.msntp
Patch0: msntp.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20020206
PreReq: OpenPKG, openpkg >= 20020206
%if "%{with_fsl}" == "yes"
BuildPreReq: fsl >= 1.2.0
PreReq: fsl >= 1.2.0
%endif
AutoReq: no
AutoReqProv: no
@ -52,13 +62,13 @@ AutoReqProv: no
%prep
%setup -q
%{l_shtool} subst -e 's/syslog(LOG_.*;/return;/' unix.c
%patch -p1
%build
CC="%{l_cc}"
CFLAGS="%{l_cflags -O}"
LDFLAGS=""
LIBS="-lm"
LDFLAGS="%{l_fsl_ldflags}"
LIBS="%{l_fsl_libs} -lm"
case "%{l_target}" in
*-solaris* ) LIBS="$LIBS -lsocket -lnsl" ;;
esac
@ -72,15 +82,56 @@ AutoReqProv: no
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/man/man1
$RPM_BUILD_ROOT%{l_prefix}/var/msntp \
$RPM_BUILD_ROOT%{l_prefix}/man/man1 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl
# install program file and manpage
%{l_shtool} install -c -s -m 755 \
msntp $RPM_BUILD_ROOT%{l_prefix}/bin/
%{l_shtool} install -c -m 644 \
msntp.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.msntp} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# install OSSP fsl configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE fsl.msntp} \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%not %dir %{l_prefix}/etc/fsl' \
'%config %{l_prefix}/etc/fsl/fsl.msntp'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%pre
# before upgrade, save status and stop service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} msntp status 2>/dev/null | tee %{l_tmpfile}`
%{l_rc} msntp stop 2>/dev/null
exit 0
%post
if [ $1 -eq 2 ]; then
# after upgrade, restore status
eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
[ ".$msntp_active" = .yes ] && %{l_rc} msntp start
fi
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} msntp stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/msntp/*.log* >/dev/null 2>&1 || true
exit 0

58
msntp/rc.msntp

@ -0,0 +1,58 @@
#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
##
## rc.msntp -- Run-Commands
##
%config
msntp_enable="$openpkg_rc_def"
msntp_log_prolog="true"
msntp_log_epilog="true"
msntp_log_numfiles="10"
msntp_log_minsize="1M"
msntp_log_complevel="9"
%common
msntp_pidfile="@l_prefix@/var/msntp/msntp.pid"
msntp_signal () {
[ -f $msntp_pidfile ] && kill -$1 `cat $msntp_pidfile`
}
%status -u @l_susr@ -o
msntp_usable="no"
msntp_active="no"
rcService msntp enable yes && \
msntp_signal 0 && msntp_active="yes"
echo "msntp_enable=\"$msntp_enable\""
echo "msntp_usable=\"$msntp_usable\""
echo "msntp_active=\"$msntp_active\""
%start -u @l_susr@
rcService msntp enable yes || exit 0
rcService msntp active yes && exit 0
@l_prefix@/bin/msntp -S &
echo $! >$msntp_pidfile
%stop -u @l_susr@
rcService msntp enable yes || exit 0
rcService msntp active no && exit 0
msntp_signal TERM
rm -f $msntp_pidfile
%restart -u @l_susr@
rcService msntp enable yes || exit 0
rcService msntp active no && exit 0
rc msntp stop
sleep 2
rc msntp start
%daily -u @l_susr@
rcService msntp enable yes || exit 0
# rotate logfile
shtool rotate -f \
-n ${msntp_log_numfiles} -s ${msntp_log_minsize} -d \
-z ${msntp_log_complevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
-P "${msntp_log_prolog}" \
-E "${msntp_log_epilog} && rc msntp restart" \
@l_prefix@/var/msntp/msntp.log
Loading…
Cancel
Save