From owner-freebsd-ports Sun Nov 18 10:20:28 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 71B2737B419 for ; Sun, 18 Nov 2001 10:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fAIIK1343402; Sun, 18 Nov 2001 10:20:01 -0800 (PST) (envelope-from gnats) Received: from smtp.noos.fr (camus.noos.net [212.198.2.70]) by hub.freebsd.org (Postfix) with ESMTP id 6F74137B405 for ; Sun, 18 Nov 2001 10:12:48 -0800 (PST) Received: (qmail 113041880 invoked by uid 0); 18 Nov 2001 17:31:56 -0000 Received: from unknown (HELO gits.dyndns.org) ([212.198.229.145]) (envelope-sender ) by 212.198.2.70 (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 18 Nov 2001 17:31:56 -0000 Received: (from root@localhost) by gits.dyndns.org (8.11.6/8.11.6) id fAIHVr982151; Sun, 18 Nov 2001 18:31:53 +0100 (CET) (envelope-from root) Message-Id: <200111181731.fAIHVr982151@gits.dyndns.org> Date: Sun, 18 Nov 2001 18:31:53 +0100 (CET) From: Cyrille Lefevre Reply-To: Cyrille Lefevre To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: ports/32080: Maintainer update: misc/upclient (4.2.1.23) Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 32080 >Category: ports >Synopsis: Maintainer update: misc/upclient (4.2.1.23) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Sun Nov 18 10:20:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Cyrille Lefevre >Release: FreeBSD 4.4-STABLE i386 >Organization: ACME >Environment: System: FreeBSD gits 4.4-STABLE FreeBSD 4.4-STABLE #10: Sat Nov 10 19:15:45 CET 2001 root@gits:/disk2/4.x-stable/src/sys/compile/CUSTOM i386 >Description: The Uptimes Project is come back... see http://uptimes.wonko.com/ for details. Makefile PORTVERSION bumped. PORTVERSION and BROKEN deleted. MASTER_SITES updated. rules rewrotten. distinfo updated. pkg-descr WWW updated. pkg-message partly rewrotten. pkg-plist upclient.conf handling fixed. docs added. files/patch-aa (src/Makefile) updated as needed. files/patch-ab (upclient.conf -> conf/upclient.conf) UptimeServer updated. files/patch-options.c cfg_upserver, cfg_interval and cfg_pidfile changed. files/patch-options.h updated as needed. files/patch-stats-bsd.c remastered. files/patch-upchk updated as needed. files/upclient.sh rewrotten. >How-To-Repeat: n/a >Fix: Index: Makefile =================================================================== RCS file: /home/ncvs/ports/misc/upclient/Makefile,v retrieving revision 1.12 diff -u -r1.12 Makefile --- Makefile 2001/08/30 03:58:34 1.12 +++ Makefile 2001/11/18 16:49:08 @@ -6,33 +6,81 @@ # PORTNAME= upclient -PORTVERSION= 4.2.1.21 -PORTREVISION= 1 +PORTVERSION= 4.2.1.23 CATEGORIES= misc -MASTER_SITES= http://uptimes.atomicvoid.net/files/ \ - ftp://ftp.uptimes.net/pub/uptimes/ \ - http://www.uptimes.net/download/ +MASTER_SITES= http://uptimes.atomicvoid.net/files/ MAINTAINER= clefevre@citeweb.net -BROKEN= The 'uptime' project is closed for an undetermined period of \ - time. You are advised to shutdown your uptime client until \ - the new version is ready. See http://www.uptimes.net/ for \ - details. +# Global variables +# ALL_TARGET= bsd BUILD_WRKSRC= ${WRKSRC}/src -post-patch: - @${PERL} -pi.fbsd -e 's.!!PREFIX!!.${PREFIX}.g' ${WRKSRC}/scripts/upchk +MSG_FILE= ${PKGDIR}/pkg-message +PKGMESSAGE= ${WRKDIR}/pkg-message -do-install: - @${INSTALL_SCRIPT} ${FILESDIR}/upclient.sh ${PREFIX}/etc/rc.d/upclient.sh - @${INSTALL_DATA} -m 600 ${WRKSRC}/upclient.conf ${PREFIX}/etc/upclient.conf.sample +# Local variables +# + +DOC_FILES= AUTHORS COPYING FAQ HISTORY INSTALL README TODO + +.include + +# Post-patch +# + +post-patch: patch-script patch-message + +patch-script: + @${PERL} -pi.fbsd -e 's.%%PREFIX%%.${PREFIX}.g' ${WRKSRC}/scripts/upchk + +patch-message: + @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE} + +# Install +# + +do-install: install-program install-sample install-script + +install-program: + @${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/upclient \ + ${PREFIX}/sbin/upclient + +install-sample: + @${INSTALL_DATA} -m 600 ${WRKSRC}/conf/upclient.conf \ + ${PREFIX}/etc/upclient.conf.sample + +install-script: @${INSTALL_SCRIPT} ${WRKSRC}/scripts/upchk ${PREFIX}/sbin/upchk - @${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/upclient ${PREFIX}/sbin/upclient + +# Post-install +# + +post-install: install-conf install-startup install-doc display-message -post-install: - @${CAT} ${PKGMESSAGE} | ${SED} 's:/usr/local:${PREFIX}:g' +install-conf: +.if !exists(${PREFIX}/etc/upclient.conf) + @${CP} -p ${PREFIX}/etc/upclient.conf.sample \ + ${PREFIX}/etc/upclient.conf +.endif + +install-startup: + @${INSTALL_SCRIPT} ${FILESDIR}/upclient.sh \ + ${PREFIX}/etc/rc.d/upclient.sh + +install-doc: +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} +.for file in ${DOC_FILES} + @${INSTALL_DATA} ${WRKSRC}/${file} ${DOCSDIR} +.endfor +.endif + +display-message: + @${ECHO_MSG} + @${CAT} ${PKGMESSAGE} + @${ECHO_MSG} -.include +.include Index: distinfo =================================================================== RCS file: /home/ncvs/ports/misc/upclient/distinfo,v retrieving revision 1.3 diff -u -r1.3 distinfo --- distinfo 2001/01/06 17:25:05 1.3 +++ distinfo 2001/11/18 14:58:16 @@ -1 +1 @@ -MD5 (upclient-4.2.1.21.tar.gz) = 5b6ceecabb36921bbcf7dd6eebdb73c2 +MD5 (upclient-4.2.1.23.tar.gz) = 4c23b4623ecd490b5d3e31ac67f20feb Index: pkg-descr =================================================================== RCS file: /home/ncvs/ports/misc/upclient/pkg-descr,v retrieving revision 1.3 diff -u -r1.3 pkg-descr --- pkg-descr 2001/01/05 03:37:06 1.3 +++ pkg-descr 2001/11/18 16:50:55 @@ -2,4 +2,4 @@ sends it to a server where you can compare it to many other hosts and browse through various statistical information. -WWW: http://www.uptimes.net/ +WWW: http://uptimes.wonko.com/ Index: pkg-message =================================================================== RCS file: /home/ncvs/ports/misc/upclient/pkg-message,v retrieving revision 1.3 diff -u -r1.3 pkg-message --- pkg-message 2001/01/06 17:25:05 1.3 +++ pkg-message 2001/11/18 16:13:21 @@ -1,25 +1,23 @@ Before running the client for the first time, be sure to: - 1. visit the Server Uptimes project web site and register yourself - (WWW: http://www.uptimes.net/bottom.html?show=createaccount). + 1. visit the Uptimes project's web site and register yourself + (WWW: http://uptimes.wonko.com/newuser.php). + 2. log in (WWW: http://uptimes.wonko.com/). + 3. Add your host (WWW: http://uptimes.wonko.com/hosts.php?op=add). + It is very important that you do not lose the generated key + since, for instance, they are no way to get it back by any way. - 2. validate your registration - (WWW: http://www.uptimes.net/bottom.html?show=validate). - - 2. log in (WWW: http://www.uptimes.net/bottom.html?show=login). - - 3. Add your host (WWW: http://www.uptimes.net/bottom.html?show=addhost). - Note that in order to send your uptime information to the uptime server, you hosts need more-or-less full-time Internet access. -You will also have to edit /usr/local/etc/upclient.conf: +You will also have to edit %%PREFIX%%/etc/upclient.conf: - - AuthKey is the ID you've received when you added your host - (WWW: http://www.uptimes.net/bottom.html?show=hosts). - + - AuthKey is the ID you've received when you added your host. - Interval is the amount of time between each update. - (WWW: http://www.uptimes.net/stuff/protocol.html) - + (WWW: http://uptimes.wonko.com/uptimes42.html). Don't set this higher than 10 minutes, or else your host won't appear in the list. + - UptimeServer is the Uptimes Project's data server, currently + uptimes.wonko.com (Since the official Uptimes Project's data + server has been terminated, data.uptimes.net must not be used + anymore. So, please, take care about that). Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/misc/upclient/pkg-plist,v retrieving revision 1.2 diff -u -r1.2 pkg-plist --- pkg-plist 2001/01/05 03:37:06 1.2 +++ pkg-plist 2001/11/18 17:02:20 @@ -1,6 +1,15 @@ +@comment $FreeBSD$ etc/rc.d/upclient.sh +@unexec if cmp -s %D/etc/upclient.conf %D/etc/upclient.conf.sample; then rm -f %D/etc/upclient.conf; fi etc/upclient.conf.sample -@exec [ -f %B/upclient.conf ] || cp %B/%f %B/upclient.conf -@unexec if cmp -s %B/%f %B/upclient.conf; then rm -f %B/upclient.conf; fi +@exec [ -f %D/etc/upclient.conf ] || cp -p %D/etc/upclient.conf.sample %D/etc/upclient.conf sbin/upchk sbin/upclient +%%PORTDOCS%%share/doc/upclient/AUTHORS +%%PORTDOCS%%share/doc/upclient/COPYING +%%PORTDOCS%%share/doc/upclient/FAQ +%%PORTDOCS%%share/doc/upclient/HISTORY +%%PORTDOCS%%share/doc/upclient/INSTALL +%%PORTDOCS%%share/doc/upclient/README +%%PORTDOCS%%share/doc/upclient/TODO +%%PORTDOCS%%@dirrm share/doc/upclient Index: files/patch-aa =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-aa,v retrieving revision 1.2 diff -u -r1.2 patch-aa --- files/patch-aa 2001/01/05 03:37:06 1.2 +++ files/patch-aa 2001/11/18 16:37:08 @@ -1,6 +1,6 @@ ---- src/Makefile.orig Mon Dec 18 14:44:48 2000 -+++ src/Makefile Sat Dec 30 02:44:49 2000 -@@ -8,7 +8,7 @@ +--- src/Makefile.orig Sun Jun 17 00:48:35 2001 ++++ src/Makefile Sun Nov 18 15:58:37 2001 +@@ -9,7 +9,7 @@ #### # Location of config file (for example /etc/upclient.conf) # @@ -9,16 +9,7 @@ #### -@@ -41,7 +41,7 @@ - - bsd: - $(MAKE) CC=gcc \ -- LDFLAGS= \ -+ LDFLAGS="-lkvm" \ - OBJECTS='stats-bsd.c $(STDOPTS)' \ - CFLAGS='-DPLATFORM_BSD -DCONFIGFILE=\"$(CONFIGFILE)\"' \ - upclient -@@ -88,7 +88,7 @@ +@@ -113,7 +113,7 @@ CFLAGS='-DPLATFORM_WINNT -DCONFIGFILE=\"$(CONFIGFILE)\"' \ upclient Index: files/patch-ab =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-ab,v retrieving revision 1.3 diff -u -r1.3 patch-ab --- files/patch-ab 2001/01/06 17:25:07 1.3 +++ files/patch-ab 2001/11/18 16:36:22 @@ -1,16 +1,13 @@ ---- upclient.conf.orig Wed Dec 27 00:48:16 2000 -+++ upclient.conf Sat Dec 30 06:11:27 2000 -@@ -4,11 +4,11 @@ - # upclient.conf - # +--- conf/upclient.conf.orig Sat Jun 16 18:33:54 2001 ++++ conf/upclient.conf Sun Nov 18 17:33:13 2001 +@@ -8,8 +8,8 @@ --PidFile = /home/alex/.upclient.pid # Location of pid file -+PidFile = /var/run/upclient.pid # Location of pid file - AuthKey = # Your Authorization key -Interval = 120 # Transmit interval +-UptimeServer = data.uptimes.net # Uptimes Project's data server +Interval = 550 # Transmit interval - UptimeServer = data.uptimes.net # Uptimes Project's data server ++UptimeServer = uptimes.wonko.com # Uptimes Project's data server SendIdleTime = 1 # Send your idle time + SendLoadAvg = 1 # Send load average Index: files/patch-options.c =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-options.c,v retrieving revision 1.2 diff -u -r1.2 patch-options.c --- files/patch-options.c 2001/01/06 17:25:07 1.2 +++ files/patch-options.c 2001/11/18 16:40:21 @@ -1,26 +1,15 @@ ---- src/options.c.orig Wed Dec 27 00:41:53 2000 -+++ src/options.c Sat Dec 30 06:09:57 2000 -@@ -23,11 +23,7 @@ +--- src/options.c.orig Sat Jun 16 21:15:04 2001 ++++ src/options.c Sun Nov 18 17:40:06 2001 +@@ -16,9 +16,9 @@ + * These are the configuration options available. + */ + char cfg_authkey[AUTHKEY_REQUIRED_LEN+1] = ""; +-char cfg_upserver[UPSERVER_MAXLEN+1] = "data.uptimes.net"; +-int cfg_interval = 120; +-char cfg_pidfile[PIDFILE_MAXLEN+1] = ".upclient.pid"; ++char cfg_upserver[UPSERVER_MAXLEN+1] = "uptimes.wonko.com"; ++int cfg_interval = 550; ++char cfg_pidfile[PIDFILE_MAXLEN+1] = "/var/run/upclient.pid"; + char cfg_proxyserver[PROXYSERVER_MAXLEN+1] = ""; int cfg_proxyport = 8080; char cfg_proxyuser[PROXYUSER_MAXLEN+1] = ""; - char cfg_proxypass[PROXYPASS_MAXLEN+1] = ""; --#if defined(PLATFORM_BSD) --int cfg_sendidle = 0; --#else - int cfg_sendidle = 1; --#endif - #if defined(PLATFORM_UNIXWARE) - int cfg_sendload = 0; - #else -@@ -124,11 +120,7 @@ - strcpy(cfg_pidfile, value); - } - else if(strcmp(key, "SendIdleTime") == 0) { --#if defined(PLATFORM_BSD) -- ; --#else - cfg_sendidle = atol(value); --#endif - } - else if(strcmp(key, "SendLoadAvg") == 0) { - #if defined(PLATFORM_UNIXWARE) Index: files/patch-options.h =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-options.h,v retrieving revision 1.1 diff -u -r1.1 patch-options.h --- files/patch-options.h 2001/01/05 03:37:06 1.1 +++ files/patch-options.h 2001/11/18 16:34:56 @@ -1,26 +1,14 @@ ---- src/options.h.orig Mon Dec 18 01:22:43 2000 -+++ src/options.h Sat Dec 30 02:49:11 2000 -@@ -33,19 +33,11 @@ - extern int cfg_proxyport; +--- src/options.h.orig Sat Jun 16 17:45:50 2001 ++++ src/options.h Sun Nov 18 16:08:56 2001 +@@ -34,11 +34,7 @@ extern char cfg_proxyuser[PROXYUSER_MAXLEN+1]; extern char cfg_proxypass[PROXYPASS_MAXLEN+1]; --#if defined(PLATFORM_BSD) extern int cfg_sendidle; --#else --extern int cfg_sendidle; --#endif -#if defined(PLATFORM_UNIXWARE) --extern cfg_sendload; + extern int cfg_sendload; -#else --extern cfg_sendload; +-extern int cfg_sendload; -#endif --extern cfg_sendos; --extern cfg_sendoslevel; --extern cfg_sendcpu; -+extern int cfg_sendload; -+extern int cfg_sendos; -+extern int cfg_sendoslevel; -+extern int cfg_sendcpu; - - /* External global variables: set to reflect config options */ - extern int have_proxyserver; + extern int cfg_sendos; + extern int cfg_sendoslevel; + extern int cfg_sendcpu; Index: files/patch-stats-bsd.c =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-stats-bsd.c,v retrieving revision 1.1 diff -u -r1.1 patch-stats-bsd.c --- files/patch-stats-bsd.c 2001/01/05 03:37:06 1.1 +++ files/patch-stats-bsd.c 2001/11/18 16:34:29 @@ -1,21 +1,6 @@ ---- src/stats-bsd.c.orig Mon Dec 18 14:32:19 2000 -+++ src/stats-bsd.c Sat Dec 30 03:26:15 2000 -@@ -12,57 +12,153 @@ - /* System includes */ - #include - #include -+#include -+#include -+#include - #include - #include - #include - #include -+#include -+#include - #include - - /** +--- src/stats-bsd.c.orig Sat Jun 16 21:12:53 2001 ++++ src/stats-bsd.c Sun Nov 18 17:33:52 2001 +@@ -26,37 +26,50 @@ * @desc Get statistics */ void getstats(unsigned long *puptime, double *pload, int *pidle, char *os, char *oslevel, char *cpu) { @@ -24,138 +9,69 @@ - time_t now; size_t size; - double loadavgs[2]; -- int mib[2]; -+ int mib [2]; -+ -+ { /* ========== uptime ========== */ + int mib[2]; + +- /* Get uptime */ +- time(&now); ++ { /* ========== uptime ========== */ + static struct timeval boottime; + static int initialized = 0; ++ time_t now; + + if (!initialized) { + initialized = 1; -+ -+ mib [0] = CTL_KERN; -+ mib [1] = KERN_BOOTTIME; + -+ size = sizeof (boottime); - -- /* Get uptime */ -- time(&now); -- mib[0] = CTL_KERN; -- mib[1] = KERN_BOOTTIME; -- size = sizeof(boottime); + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + size = sizeof(boottime); - if(sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && (boottime.tv_sec != 0)) { -- *puptime = now - boottime.tv_sec; -- *puptime /= 60; -- } -- -- if(cfg_sendload) { -- /* Get load average */ -- getloadavg(loadavgs, 3); -- /* Use the 3rd element (15 minute load average) */ -- *pload = loadavgs[2]; ++ + if (sysctl (mib, 2, &boottime, &size, NULL, 0) == -1) + err (1, "sysctl: kern.boottime"); - } - -- if(cfg_sendos) { -- /* Get os info */ -- uname(&uts); ++ } ++ + if (boottime.tv_sec) { + time_t now; + + time (&now); + -+ *puptime = (now - boottime.tv_sec) / 60; -+ } + *puptime = now - boottime.tv_sec; + *puptime /= 60; + } + } + -+ if (cfg_sendidle) { /* ========== idle_time ========== */ -+ static kvm_t *kp; -+ static struct nlist namelist [] = { -+#define X_CP_TIME 0 -+ { "_cp_time" }, -+ { NULL }, -+ }; ++ if(cfg_sendload) { /* ========== loadavg ========== */ ++ double loadavgs[3] = { 0. }; + +- if(cfg_sendload) { +- /* Get load average */ + getloadavg(loadavgs, 3); + /* Use the 3rd element (15 minute load average) */ + *pload = loadavgs[2]; + } + +- if(cfg_sendos) { +- /* Get os info */ +- uname(&uts); +- } ++ if(cfg_sendcpu) { /* ========== cpu ========== */ ++ static char buf [CPU_SIZE] = ""; + static int initialized = 0; + + if (!initialized) { -+ char errbuf [_POSIX2_LINE_MAX]; + initialized = 1; -+ -+ setgid (getgid ()); -+ -+ kp = kvm_openfiles (NULL, NULL, NULL, O_RDONLY, errbuf); -+ -+ if (!kp) -+ warn ("kvm_openfiles: %s", errbuf); -+ else if (kvm_nlist (kp, namelist) == -1) -+ warn ("kvm_nlist: %s", kvm_geterr (kp)); -+ } -+ -+ if (kp) { -+ long ctime [CPUSTATES]; -+ static long stime [CPUSTATES]; -+ static int first_time = 1; -+ -+ if (first_time) { -+ first_time = 0; -+ -+ if (kvm_read (kp, namelist [X_CP_TIME].n_value, -+ stime, sizeof (stime)) == -1) -+ warn ("kvm_read: %s", kvm_geterr (kp)); -+ else -+ sleep (1); /* to avoid the initial 0 idle value */ - } - if(cfg_sendcpu) { - /* Get CPU info */ -- mib[0] = CTL_HW; -- mib[1] = HW_MODEL; -- size = CPU_SIZE; + mib[0] = CTL_HW; + if(cfg_sendcpulevel == 1) { + mib[1] = HW_MACHINE; /* Send architecture */ +@@ -64,17 +77,35 @@ + mib[1] = HW_MODEL; /* Send architecture's specific model */ + } + size = CPU_SIZE; - sysctl(mib, 2, cpu, &size, NULL, 0); -+ if (kvm_read(kp, namelist [X_CP_TIME].n_value, -+ ctime, sizeof (ctime)) == -1) -+ warn ("kvm_read: %s", kvm_geterr (kp)); -+ else { -+ int state; -+ double time = 0.; -+ -+ for (state = 0; state < CPUSTATES; state++) -+ time += ctime [state] - stime [state]; -+ -+ if (time == 0.) -+ time = 1.; -+ -+ *pidle = (ctime [CP_IDLE] - stime [CP_IDLE]) * 100. / time; -+ -+ for (state = 0; state < CPUSTATES; state++) -+ stime [state] = ctime [state]; -+ } -+ } else -+ cfg_sendidle = 0; -+ } -+ -+ if (cfg_sendload) { /* ========== loadavg ========== */ -+ double loadavgs [3] = { 0. }; + -+ getloadavg (loadavgs, 3); -+ -+ *pload = loadavgs [2]; -+ } -+ -+ if (cfg_sendcpu) { /* ========== cpu ========== */ -+ static char buf [CPU_SIZE] = ""; -+ static int initialized = 0; -+ -+ if (!initialized) { -+ initialized = 1; -+ -+ mib [0] = CTL_HW; -+ mib [1] = HW_MODEL; -+ -+ size = sizeof (buf); -+ + if (sysctl (mib, 2, buf, &size, NULL, 0) == -1) + warn ("sysctl: hw.model"); + } @@ -165,24 +81,26 @@ } if(cfg_sendos) { -- strncpy(os, uts.sysname, OS_SIZE - 1); -- if(cfg_sendoslevel) { -- strncpy(oslevel, uts.release, OSLEVEL_SIZE - 1); + static struct utsname uts; + static int initialized = 0; + + if (!initialized) { + initialized = 1; -+ ++ + uname(&uts); + } + -+ strncpy (os, uts.sysname, OS_SIZE - 1); + strncpy(os, uts.sysname, OS_SIZE - 1); + os [OS_SIZE - 1] = 0; + -+ if (cfg_sendoslevel) { -+ strncpy (oslevel, uts.release, OSLEVEL_SIZE - 1); + if(cfg_sendoslevel) { + strncpy(oslevel, uts.release, OSLEVEL_SIZE - 1); + oslevel [OSLEVEL_SIZE - 1] = 0; } } - } + +- if(cfg_sendidle) { ++ if(cfg_sendidle) { /* ========== idle_time ========== */ + static kvm_t *kp; + static int initialized = 0; + static struct nlist namelist [] = { Index: files/patch-upchk =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/patch-upchk,v retrieving revision 1.1 diff -u -r1.1 patch-upchk --- files/patch-upchk 2001/01/05 03:37:07 1.1 +++ files/patch-upchk 2001/11/18 16:35:37 @@ -1,16 +1,11 @@ ---- scripts/upchk.orig Wed Nov 29 01:19:14 2000 -+++ scripts/upchk Sat Dec 30 00:19:54 2000 -@@ -24,11 +24,11 @@ +--- scripts/upchk.orig Fri Jun 1 01:30:24 2001 ++++ scripts/upchk Sun Nov 18 16:45:59 2001 +@@ -24,7 +24,7 @@ # # change this to the full path AND name of your upclient executable: --upclient="/home/mydir/upclient" -+upclient="!!PREFIX!!/sbin/upclient" +-upclient="/usr/local/sbin/upclient" ++upclient="%%PREFIX%%/sbin/upclient" # change this to the name of your upclient's pidfile (as defined in # config.h of the upclient distribution) --pidfile="/home/mydir/upclient.pid" -+pidfile="/var/run/upclient.pid" - - ########## you probably don't need to change anything below here ########## - Index: files/upclient.sh =================================================================== RCS file: /home/ncvs/ports/misc/upclient/files/upclient.sh,v retrieving revision 1.1 diff -u -r1.1 upclient.sh --- files/upclient.sh 2001/01/05 03:37:07 1.1 +++ files/upclient.sh 2001/11/18 16:55:39 @@ -1,35 +1,80 @@ #!/bin/sh +# +# $FreeBSD$ +# +# Start or stop upclient. +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +rc_file=${0##*/} +rc_arg=$1 -if [ -f ${PREFIX}/etc/upclient.conf ]; then - if grep -qs '^[ ]*AuthKey[ ]*=' ${PREFIX}/etc/upclient.conf; then - if grep -qs '^[ ]*AuthKey[ ]*=[ ]*' ${PREFIX}/etc/upclient.conf; then - echo "upclient: AuthKey not configured in ${PREFIX}/etc/upclient.conf -- aborted." >&2 - exit 1 - fi - else - echo "upclient: ${PREFIX}/etc/upclient.conf is out of date -- aborted." >&2 - exit 1 - fi -else - echo "upclient: ${PREFIX}/etc/upclient.conf doesn't exist -- aborted." >&2 - exit 1 +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then + echo "${rc_file}: Cannot determine PREFIX." >&2 + echo "Please use the complete pathname." >&2 + exit 64 fi + +program_dir=${PREFIX}/sbin +program_file=upclient +program_path=${program_dir}/${program_file} + +config_dir=${PREFIX}/etc +config_file=${program_file}.conf +config_path=${config_dir}/${config_file} -case "$1" in +pid_dir=/var/run +pid_file=${program_file}.pid +pid_path=${pid_dir}/${pid_file} + +syslog_facility=daemon.err + +case "$rc_arg" in start) - [ -x ${PREFIX}/sbin/upclient ] && ${PREFIX}/sbin/upclient > /dev/null && echo -n ' upclient' - ;; + if [ ! -x ${program_path} ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${program_path} is missing." + exit 72 + fi + if [ ! -f ${config_path} ]; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: ${config_path} is missing." + exit 72 + fi + ws=" " + if ! grep -qs "^[$ws]*AuthKey[$ws]*=" ${config_path}; then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: AuthKey is missing from" \ + "${config_path}." + exit 72 + fi + if grep -qs "^[$ws]*AuthKey[$ws]*=[$ws]*" ${config_path} + then + logger -sp ${syslog_facility} -t ${program_file} \ + "unable to start: AuthKey isn't configured in" \ + "${config_path}." + exit 72 + fi + ${program_path} && + echo -n " ${program_file}" + ;; stop) - [ -r /var/run/upclient.pid ] && kill `cat /var/run/upclient.pid` > /dev/null && echo -n ' upclient' - ;; + if [ -r ${pid_path} ]; then + kill $(cat ${pid_path}) 2> /dev/null + else + killall ${program_file} 2> /dev/null + fi + ;; +restart) + $0 stop + $0 start + ;; +status) + ps -auxww | egrep ${program_file} | egrep -v "($0|egrep)" + ;; *) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; + echo "usage: ${rc_file} {start|stop|restart|status}" >&2 + exit 64 + ;; esac exit 0 >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message