Преглед на файлове

new package: hclnfsd 10.0.0.1 (Hummingbird NFS Authentication Daemon)

Ralf S. Engelschall преди 21 години
родител
ревизия
d460b8dd6f
променени са 4 файла, в които са добавени 248 реда и са изтрити 0 реда
  1. 6 0
      hclnfsd/hclnfsd.acl
  2. 58 0
      hclnfsd/hclnfsd.patch
  3. 122 0
      hclnfsd/hclnfsd.spec
  4. 62 0
      hclnfsd/rc.hclnfsd

+ 6 - 0
hclnfsd/hclnfsd.acl

@@ -0,0 +1,6 @@
+##
+##  hclnfsd.acl -- Client Access Control List
+##
+#=192.168.0.1 192.168.0.2
+#-192.168.0.3 255.255.255.255
+#+192.168.0.0 255.255.255.0

+ 58 - 0
hclnfsd/hclnfsd.patch

@@ -0,0 +1,58 @@
+Index: hclnfsd.c
+--- hclnfsd.c.orig	2004-11-26 21:37:02 +0100
++++ hclnfsd.c	2004-12-08 12:08:35 +0100
+@@ -224,6 +224,7 @@
+ static time_t GidCacheTimeoutTime=0;
+ int debugmode, DontDoPrinting;
+ char *debuglog;
++char *pidfile;
+ 
+ struct queueentry {
+ 	int jobid;
+@@ -2920,6 +2921,7 @@
+ 	prog = argv[0];
+ 	debugmode = 0;
+ 	debuglog = NULL;
++	pidfile = NULL;
+ 	DontDoPrinting = 0;
+ 	if (sizeof(_uint32) != 4)
+ 		ErrAndDie("Integral size mismatch.  Try defining INT32_LONG and recompiling\n", NULL, NULL, NULL, NULL);
+@@ -2982,6 +2984,19 @@
+ 		argv++;
+ 		goto another;
+ 	}
++	if ((argc > 0) && (strcmp(*argv, "-p") == 0)) {
++		argc--;
++		argv++;
++		if (argc < 1)
++			ErrAndDie(USAGE, prog, NULL, NULL, NULL);
++		if (**argv)
++			pidfile = my_strdup(*argv);
++		if (pidfile == NULL)
++			ErrAndDie("Out of Memory", NULL, NULL, NULL, NULL);
++		argc--;
++		argv++;
++		goto another;
++	}
+ 	if ((argc != 1) && (!DontDoPrinting))
+ 		ErrAndDie(USAGE, prog, NULL, NULL, NULL);
+ 
+@@ -3065,6 +3080,18 @@
+ 			fprintf(stdout,"%s: [main] real group %d, effective group %d\n", PROGNAME, getgid(), getegid());
+ 			debugmode++;
+ 		}
++        /* write pid file */
++        {
++            pid_t pid;
++            FILE *fp;
++            pid = getpid();
++            if ((fp = fopen(pidfile, "w")) == NULL) {
++                fprintf(stderr, "%s: [main] cannot write pidfile '%s'", PROGNAME, pidfile);
++                exit(1);
++            }
++            fprintf(fp, "%ld\n", (long)pid);
++            fclose(fp);
++        }
+ 	}
+ 
+ 	if (!DontDoPrinting) {

+ 122 - 0
hclnfsd/hclnfsd.spec

@@ -0,0 +1,122 @@
+##
+##  hclnfsd.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
+##  Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package information
+Name:         hclnfsd
+Summary:      Hummingbird NFS Authentication Daemon
+URL:          http://www.hclnfsd.org/
+Vendor:       Hummingbird
+Packager:     The OpenPKG Project
+Distribution: OpenPKG
+Class:        EVAL
+Group:        Network
+License:      PD
+Version:      10.0.0.1
+Release:      20041208
+
+#   list of sources
+Source0:      ftp://ftp.openpkg.org/sources/CPY/VERSIONED/hclnfsd/hclnfsd-%{version}.tar
+Source1:      hclnfsd.acl
+Source2:      rc.hclnfsd
+Patch0:       hclnfsd.patch
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20040130
+PreReq:       OpenPKG, openpkg >= 20040130
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    hclnfsd is the Hummingbird NFS authentication daemon. It is a
+    super-set of the old PCNFSD from Sun.
+
+%track
+    prog hclnfsd = {
+        version   = %{version}
+        url       = ftp://ftp.openpkg.org/sources/CPY/VERSIONED/hclnfsd/
+        regex     = hclnfsd-(__VER__)\.tar
+    }
+
+%prep
+    %setup -q -c
+    %patch -p0
+
+%build
+    #   build program
+    platform=""
+    case "%{l_platform -t}" in
+        *-freebsd* ) platform="freebsd" ;;
+        *-linux*   ) platform="linux"   ;;
+        *-sunos*   ) platform="solaris" ;;
+        * ) echo "Platform \"%{l_platform -t}\" not supported" 1>&2; exit 1 ;;
+    esac
+    %{l_make} %{l_mflags} -f makefile $platform
+
+%install
+    rm -rf $RPM_BUILD_ROOT
+
+    #   create installation hierarchy
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/hclnfsd \
+        $RPM_BUILD_ROOT%{l_prefix}/var/hclnfsd
+
+    #   install program
+    %{l_shtool} install -c -s -m 755 \
+        hclnfsd $RPM_BUILD_ROOT%{l_prefix}/sbin/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.hclnfsd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   install access control list
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE hclnfsd.acl} $RPM_BUILD_ROOT%{l_prefix}/etc/hclnfsd/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+
+%post
+    #   after upgrade, restart service
+    [ $1 -eq 2 ] || exit 0
+    eval `%{l_rc} hclnfsd status 2>/dev/null`
+    [ ".$hclnfsd_active" = .yes ] && %{l_rc} hclnfsd restart
+    exit 0
+
+%preun
+    #   before erase, stop service and remove log files
+    [ $1 -eq 0 ] || exit 0
+    %{l_rc} hclnfsd stop 2>/dev/null
+    rm -f $RPM_INSTALL_PREFIX/var/hclnfsd/*
+    exit 0
+

+ 62 - 0
hclnfsd/rc.hclnfsd

@@ -0,0 +1,62 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.hclnfsd -- Run-Commands
+##
+
+%config
+    hclnfsd_enable="$openpkg_rc_def"
+    hclnfsd_flags=""
+    hclnfsd_log_prolog="true"
+    hclnfsd_log_epilog="true"
+    hclnfsd_log_numfiles="10"
+    hclnfsd_log_minsize="1M"
+    hclnfsd_log_complevel="9"
+
+%common
+    hclnfsd_aclfile="@l_prefix@/etc/hclnfsd/hclnfsd.acl"
+    hclnfsd_logfile="@l_prefix@/var/hclnfsd/hclnfsd.log"
+    hclnfsd_pidfile="@l_prefix@/var/hclnfsd/hclnfsd.pid"
+    hclnfsd_signal () {
+        [ -f $hclnfsd_pidfile ] && kill -$1 `cat $hclnfsd_pidfile`
+    }
+
+%status -u @l_susr@ -o
+    hclnfsd_usable="no"
+    hclnfsd_active="no"
+    rcService hclnfsd enable yes && \
+        hclnfsd_signal 0 && hclnfsd_active="yes"
+    echo "hclnfsd_enable=\"$hclnfsd_enable\""
+    echo "hclnfsd_usable=\"$hclnfsd_usable\""
+    echo "hclnfsd_active=\"$hclnfsd_active\""
+
+%start -p 100 -u @l_susr@
+    rcService hclnfsd enable yes || exit 0
+    rcService hclnfsd active yes && exit 0
+    @l_prefix@/sbin/hclnfsd \
+        -A -X \
+        -s ${hclnfsd_aclfile} \
+        -l ${hclnfsd_logfile} \
+        -p ${hclnfsd_pidfile} \
+        ${hclnfsd_flags}
+
+%stop -p 900 -u @l_susr@
+    rcService hclnfsd enable yes || exit 0
+    rcService hclnfsd active no  && exit 0
+    hclnfsd_signal TERM
+    sleep 2
+    rm -f $hclnfsd_pidfile >/dev/null 2>&1 || true
+
+%restart -p 100 -u @l_susr@
+    rcService hclnfsd enable yes || exit 0
+    rcService hclnfsd active no  && exit 0
+    rc hclnfsd stop start
+
+%daily -u @l_susr@
+    rcService hclnfsd enable yes || exit 0
+    shtool rotate -f \
+        -n ${hclnfsd_log_numfiles} -s ${hclnfsd_log_minsize} -d \
+        -z ${hclnfsd_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
+        -P "${hclnfsd_log_prolog}" \
+        -E "${hclnfsd_log_epilog} && rc hclnfsd reload" \
+        $hclnfsd_logfile
+