diff options
author | James E. Housley <jeh@FreeBSD.org> | 2001-01-05 03:37:07 +0000 |
---|---|---|
committer | James E. Housley <jeh@FreeBSD.org> | 2001-01-05 03:37:07 +0000 |
commit | 9efa8d4a6c744fc8f65de387a6c6e117e37134c5 (patch) | |
tree | 807e3cb9ad5c24e6f906c1465a868a9add5e952b /misc/upclient | |
parent | 0ac9c6b641102d92275ada9dcbafee3e607f4682 (diff) | |
download | ports-9efa8d4a6c744fc8f65de387a6c6e117e37134c5.tar.gz ports-9efa8d4a6c744fc8f65de387a6c6e117e37134c5.zip |
Notes
Diffstat (limited to 'misc/upclient')
-rw-r--r-- | misc/upclient/Makefile | 23 | ||||
-rw-r--r-- | misc/upclient/distinfo | 2 | ||||
-rw-r--r-- | misc/upclient/files/patch-aa | 39 | ||||
-rw-r--r-- | misc/upclient/files/patch-ab | 20 | ||||
-rw-r--r-- | misc/upclient/files/patch-options.c | 26 | ||||
-rw-r--r-- | misc/upclient/files/patch-options.h | 26 | ||||
-rw-r--r-- | misc/upclient/files/patch-stats-bsd.c | 188 | ||||
-rw-r--r-- | misc/upclient/files/patch-upchk | 16 | ||||
-rw-r--r-- | misc/upclient/files/upclient.sh | 35 | ||||
-rw-r--r-- | misc/upclient/pkg-comment | 2 | ||||
-rw-r--r-- | misc/upclient/pkg-descr | 9 | ||||
-rw-r--r-- | misc/upclient/pkg-message | 24 | ||||
-rw-r--r-- | misc/upclient/pkg-plist | 8 |
13 files changed, 363 insertions, 55 deletions
diff --git a/misc/upclient/Makefile b/misc/upclient/Makefile index f8e7554697ae..d8b33ce91f9e 100644 --- a/misc/upclient/Makefile +++ b/misc/upclient/Makefile @@ -6,18 +6,27 @@ # PORTNAME= upclient -PORTVERSION= 3.04 +PORTVERSION= 4.2.1.19 CATEGORIES= misc -MASTER_SITES= http://uptime.hexon.cx/download/ +MASTER_SITES= ftp://ftp.uptimes.net/pub/uptimes/ \ + http://www.uptimes.net/download/ \ + http://uptimes.atomicvoid.net/ -MAINTAINER= kbyanc@posi.net - -BROKEN= Client is outdated and new client cannot be reasonably ported +MAINTAINER= clefevre@citeweb.net ALL_TARGET= bsd -INSTALL_TARGET= bsd install CP=$(CP) +BUILD_WRKSRC= ${WRKSRC}/src + +post-patch: + @${PERL} -pi.fbsd -e 's.!!PREFIX!!.${PREFIX}.g' ${WRKSRC}/scripts/upchk + +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 + @${INSTALL_SCRIPT} ${WRKSRC}/scripts/upchk ${PREFIX}/sbin/upchk + @${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/upclient ${PREFIX}/sbin/upclient post-install: - ${CAT} ${PKGMESSAGE} | ${SED} 's:/usr/local:${PREFIX}:g' + @${CAT} ${PKGMESSAGE} | ${SED} 's:/usr/local:${PREFIX}:g' .include <bsd.port.mk> diff --git a/misc/upclient/distinfo b/misc/upclient/distinfo index 26394ae8ee8f..f00db859371e 100644 --- a/misc/upclient/distinfo +++ b/misc/upclient/distinfo @@ -1 +1 @@ -MD5 (upclient-3.04.tar.gz) = 5a67b17ef0ddbd44fa668c81d8de0547 +MD5 (upclient-4.2.1.19.tar.gz) = c832a7885de2a20e2427bddfacd09d37 diff --git a/misc/upclient/files/patch-aa b/misc/upclient/files/patch-aa index 2548b11b7689..b743569e83f8 100644 --- a/misc/upclient/files/patch-aa +++ b/misc/upclient/files/patch-aa @@ -1,30 +1,29 @@ ---- Makefile.orig Sat Apr 10 02:47:19 1999 -+++ Makefile Fri Aug 20 14:51:05 1999 -@@ -1,7 +1,7 @@ - # Uptime Client Makefile - +--- src/Makefile.orig Mon Dec 18 14:44:48 2000 ++++ src/Makefile Sat Dec 30 02:44:49 2000 +@@ -8,7 +8,7 @@ + #### # Location of config file (for example /etc/upclient.conf) + # -CONFIGFILE = upclient.conf +CONFIGFILE = $(PREFIX)/etc/upclient.conf - ################ -@@ -29,10 +29,8 @@ - upclient + #### +@@ -41,7 +41,7 @@ bsd: -- $(MAKE) CC=gcc \ + $(MAKE) CC=gcc \ - LDFLAGS= \ -- OBJECTS= \ -- CFLAGS='-DPLAT_xxxBSD -DCONFIGFILE=\"$(CONFIGFILE)\"' \ -+ $(MAKE) OBJECTS= \ -+ CFLAGS='$(CFLAGS) -DPLAT_xxxBSD -DCONFIGFILE=\"$(CONFIGFILE)\"' \ ++ LDFLAGS="-lkvm" \ + OBJECTS='stats-bsd.c $(STDOPTS)' \ + CFLAGS='-DPLATFORM_BSD -DCONFIGFILE=\"$(CONFIGFILE)\"' \ upclient +@@ -88,7 +88,7 @@ + CFLAGS='-DPLATFORM_WINNT -DCONFIGFILE=\"$(CONFIGFILE)\"' \ + upclient + +-upclient: upclient.h ++upclient: upclient.h $(OBJECTS) + $(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) upclient.c -o $(BINNAME) - solaris: -@@ -88,3 +86,5 @@ - install: prepared-for-install - strip $(BINNAME) - chmod 755 $(BINNAME) -+ $(INSTALL) $(BINNAME) $(PREFIX)/bin -+ $(CP) upclient.conf $(PREFIX)/etc + clean: diff --git a/misc/upclient/files/patch-ab b/misc/upclient/files/patch-ab index f96076a7a67a..b423a9795820 100644 --- a/misc/upclient/files/patch-ab +++ b/misc/upclient/files/patch-ab @@ -1,9 +1,11 @@ ---- upclient.conf.orig Fri Aug 20 11:22:32 1999 -+++ upclient.conf Fri Aug 20 11:25:12 1999 -@@ -3,5 +3,5 @@ - HostID <HostID> - Login <Loginname> - Pass <Password> --Interval 60 -+Interval 550 - UptimeServer uptime.hexon.cx +--- upclient.conf.orig Mon Dec 18 14:19:35 2000 ++++ upclient.conf Sat Dec 30 00:37:19 2000 +@@ -4,7 +4,7 @@ + # upclient.conf + # + +-PidFile = /home/alex/.upclient.pid # Location of pid file ++PidFile = /var/run/upclient.pid # Location of pid file + + AuthKey = <your_authkey> # Your Authorization key + Interval = 120 # Transmit interval diff --git a/misc/upclient/files/patch-options.c b/misc/upclient/files/patch-options.c new file mode 100644 index 000000000000..6adf0f6e35a6 --- /dev/null +++ b/misc/upclient/files/patch-options.c @@ -0,0 +1,26 @@ +--- src/options.c.orig Mon Dec 18 02:20:24 2000 ++++ src/options.c Sat Dec 30 02:48:01 2000 +@@ -23,11 +23,7 @@ + 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 +@@ -99,11 +95,7 @@ + else if(strcmp(key, "PidFile") == 0) + 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) + ; diff --git a/misc/upclient/files/patch-options.h b/misc/upclient/files/patch-options.h new file mode 100644 index 000000000000..ae8744b4a5b3 --- /dev/null +++ b/misc/upclient/files/patch-options.h @@ -0,0 +1,26 @@ +--- 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; + 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; +-#else +-extern 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; diff --git a/misc/upclient/files/patch-stats-bsd.c b/misc/upclient/files/patch-stats-bsd.c new file mode 100644 index 000000000000..d53fa937e08c --- /dev/null +++ b/misc/upclient/files/patch-stats-bsd.c @@ -0,0 +1,188 @@ +--- 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 <stdio.h> + #include <errno.h> ++#include <fcntl.h> ++#include <limits.h> ++#include <kvm.h> + #include <syslog.h> + #include <sys/time.h> + #include <sys/param.h> + #include <sys/sysctl.h> ++#include <sys/dkstat.h> ++#include <devstat.h> + #include <sys/utsname.h> + + /** + * @desc Get statistics + */ + void getstats(unsigned long *puptime, double *pload, int *pidle, char *os, char *oslevel, char *cpu) { +- struct utsname uts; +- struct timeval boottime; +- time_t now; + size_t size; +- double loadavgs[2]; +- int mib[2]; ++ int mib [2]; ++ ++ { /* ========== uptime ========== */ ++ static struct timeval boottime; ++ static int initialized = 0; ++ ++ 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); +- 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; ++ } ++ } ++ ++ if (cfg_sendidle) { /* ========== idle_time ========== */ ++ static kvm_t *kp; ++ static struct nlist namelist [] = { ++#define X_CP_TIME 0 ++ { "_cp_time" }, ++ { NULL }, ++ }; ++ 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; +- 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"); ++ } ++ ++ strncpy (cpu, buf, CPU_SIZE); ++ cpu [CPU_SIZE - 1] = 0; + } + + 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); ++ os [OS_SIZE - 1] = 0; ++ ++ if (cfg_sendoslevel) { ++ strncpy (oslevel, uts.release, OSLEVEL_SIZE - 1); ++ oslevel [OSLEVEL_SIZE - 1] = 0; + } + } + } diff --git a/misc/upclient/files/patch-upchk b/misc/upclient/files/patch-upchk new file mode 100644 index 000000000000..434f5dc23e77 --- /dev/null +++ b/misc/upclient/files/patch-upchk @@ -0,0 +1,16 @@ +--- scripts/upchk.orig Wed Nov 29 01:19:14 2000 ++++ scripts/upchk Sat Dec 30 00:19:54 2000 +@@ -24,11 +24,11 @@ + # + + # change this to the full path AND name of your upclient executable: +-upclient="/home/mydir/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 ########## + diff --git a/misc/upclient/files/upclient.sh b/misc/upclient/files/upclient.sh new file mode 100644 index 000000000000..70470e68b6fa --- /dev/null +++ b/misc/upclient/files/upclient.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then + echo "$0: Cannot determine the PREFIX" >&2 + exit 1 +fi + +if [ -f ${PREFIX}/etc/upclient.conf ]; then + if grep -qs '^[ ]*AuthKey[ ]*=' ${PREFIX}/etc/upclient.conf; then + if grep -qs '^[ ]*AuthKey[ ]*=[ ]*<your_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 +fi + +case "$1" in +start) + [ -x ${PREFIX}/sbin/upclient ] && ${PREFIX}/sbin/upclient > /dev/null && echo -n ' upclient' + ;; +stop) + [ -r /var/run/upclient.pid ] && kill `cat /var/run/upclient.pid` > /dev/null && echo -n ' upclient' + ;; +*) + echo "Usage: `basename $0` {start|stop}" >&2 + ;; +esac + +exit 0 diff --git a/misc/upclient/pkg-comment b/misc/upclient/pkg-comment index b1a7ba505b64..abc1411240cb 100644 --- a/misc/upclient/pkg-comment +++ b/misc/upclient/pkg-comment @@ -1 +1 @@ -The Server Uptimes project client +The Uptimes project client diff --git a/misc/upclient/pkg-descr b/misc/upclient/pkg-descr index 9aa5eaa839d0..7dcce5709d5a 100644 --- a/misc/upclient/pkg-descr +++ b/misc/upclient/pkg-descr @@ -1,8 +1,5 @@ -This is the client program for the Server Uptimes project. -For more information on the Server Uptimes project visit their web site at: +Uptime Client is a little program that keeps track of your uptime and +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/ -(old URL is http://uptime.hexon.cx/) - - -Kelly - kbyanc@posi.net diff --git a/misc/upclient/pkg-message b/misc/upclient/pkg-message index 7b9a496b6756..d223b08fe0b2 100644 --- a/misc/upclient/pkg-message +++ b/misc/upclient/pkg-message @@ -1,18 +1,24 @@ Before running the client for the first time, be sure to: + 1. visit the Server Uptimes project web site and register yourself - (WWW: http://uptime.hexon.cx/register.html), + (WWW: http://www.uptimes.net/bottom.html?show=createaccount). + + 2. validate your registration + (WWW: http://www.uptimes.net/bottom.html?show=validate). - 2. log in (WWW: http://uptime.hexon.cx/login) + 2. log in (WWW: http://www.uptimes.net/bottom.html?show=login). - 3. Add your host (WWW: http://uptime.hexon.cx/login/cgi-bin/addhost.cgi) + 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 need to edit /usr/local/etc/upclient.conf: -HostID is the ID you've received when you added your host -Login and pass are your login and password -Interval is the amount of time between each update. -Don't set this higher than 10 minutes, or else your host -won't appear in the list. +You will also have to edit /usr/local/etc/upclient.conf: + + - AuthKey is the ID you've received when you added your host + (WWW: http://www.uptimes.net/bottom.html?show=hosts). + + - Interval is the amount of time between each update. + Don't set this higher than 10 minutes, or else your host + won't appear in the list. diff --git a/misc/upclient/pkg-plist b/misc/upclient/pkg-plist index 31a45bd42dc8..eca9fa13942b 100644 --- a/misc/upclient/pkg-plist +++ b/misc/upclient/pkg-plist @@ -1,2 +1,6 @@ -bin/upclient -etc/upclient.conf +etc/rc.d/upclient.sh +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 +sbin/upchk +sbin/upclient |