1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

* Upgrade to 5.0.b5.

* Changed MASTER_SITES.
* Respect PREFIX correctly.

PR:		44283
Submitted by:	maintainer
This commit is contained in:
Oliver Braun 2002-10-19 22:14:38 +00:00
parent e9f358b982
commit 6aee96b6e7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=68386
9 changed files with 311 additions and 119 deletions

View File

@ -6,9 +6,10 @@
#
PORTNAME= upclient
PORTVERSION= 4.2.1.23
PORTVERSION= 5.0.b5
CATEGORIES= misc
MASTER_SITES= http://uptimes.atomicvoid.net/files/
MASTER_SITES= http://uptimes.wonko.com/files/
DISTNAME= ${PORTNAME}-${PORTVERSION:R}${PORTVERSION:E}
MAINTAINER= cyrille.lefevre@laposte.net
@ -22,20 +23,24 @@ BUILD_WRKSRC= ${WRKSRC}/src
MSG_FILE= ${PKGDIR}/pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message
MAN8= upclient.8
# Local variables
#
DOC_FILES= AUTHORS COPYING FAQ HISTORY INSTALL README TODO
DOC_FILES+= HISTORY-BETA
.include <bsd.port.pre.mk>
# Post-patch
#
post-patch: patch-script patch-message
post-patch: patch-prefix patch-message
patch-script:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/scripts/upchk
patch-prefix:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
${WRKSRC}/scripts/upchk ${WRKSRC}/src/Makefile
patch-message:
@${SED} 's|%%PREFIX%%|${PREFIX}|g' ${MSG_FILE} > ${PKGMESSAGE}
@ -43,14 +48,18 @@ patch-message:
# Install
#
do-install: install-program install-sample install-script
do-install: install-program install-man install-sample install-script
install-program:
@${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/upclient \
@${INSTALL_PROGRAM} -g kmem -m 2555 ${WRKSRC}/src/products/upclient \
${PREFIX}/sbin/upclient
install-man:
@${INSTALL_MAN} ${WRKSRC}/src/products/upclient.8 \
${MAN8PREFIX}/man/man8
install-sample:
@${INSTALL_DATA} -m 600 ${WRKSRC}/conf/upclient.conf \
@${INSTALL_DATA} -m 600 ${WRKSRC}/src/products/upclient.conf \
${PREFIX}/etc/upclient.conf.sample
install-script:

View File

@ -1 +1 @@
MD5 (upclient-4.2.1.23.tar.gz) = 4c23b4623ecd490b5d3e31ac67f20feb
MD5 (upclient-5.0b5.tar.gz) = fa6a74f146eacf47f4b0773a835a570e

View File

@ -1,20 +1,20 @@
--- 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)
#
-CONFIGFILE = upclient.conf
+CONFIGFILE = $(PREFIX)/etc/upclient.conf
--- src/Makefile.orig Thu Oct 10 04:36:35 2002
+++ src/Makefile Sat Oct 19 23:21:49 2002
@@ -44,7 +44,7 @@
####
@@ -113,7 +113,7 @@
CFLAGS='-DPLATFORM_WINNT -DCONFIGFILE=\"$(CONFIGFILE)\"' \
upclient
# System directories
-prefix = /usr/local
+prefix = %%PREFIX%%
#prefix = /sw
#prefix = /opt/${PROGRAMNAME}
-upclient: upclient.h
+upclient: upclient.h $(OBJECTS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) upclient.c -o $(BINNAME)
@@ -55,7 +55,7 @@
sbindir = ${exec_prefix}/sbin
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
-localstatedir = ${prefix}/var
+localstatedir = /var
clean:
# Further Reading
# Filesystem Hierarchy Standard 2.2 May 24, 2001

View File

@ -1,13 +1,11 @@
--- 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 @@
--- src/conf/upclient.conf.orig Thu Oct 10 04:36:24 2002
+++ src/conf/upclient.conf Sat Oct 19 19:41:36 2002
@@ -9,7 +9,7 @@
AuthKey = <your_authkey> # Your Authorization key
AuthKey = <your_authkey> # Your Authorization key
-Interval = 120 # Transmit interval
-UptimeServer = data.uptimes.net # Uptimes Project's data server
+Interval = 550 # Transmit interval
+UptimeServer = uptimes.wonko.com # Uptimes Project's data server
-Interval = 300 # Transmit interval
+Interval = 550 # Transmit interval
UptimeServer = @UPTIMES_SERVER@ # Uptimes Project's data server
SendIdleTime = 1 # Send your idle time
SendLoadAvg = 1 # Send load average
SendIdleTime = 1 # Send your idle time

View File

@ -1,15 +1,11 @@
--- 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.
--- src/options.c.orig Wed Oct 2 06:50:49 2002
+++ src/options.c Sat Oct 19 22:54:06 2002
@@ -55,7 +55,7 @@
*/
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";
char cfg_upserver[UPSERVER_MAXLEN+1] = "uptimes.wonko.com";
-int cfg_interval = 300;
+int cfg_interval = 550;
+char cfg_pidfile[PIDFILE_MAXLEN+1] = "/var/run/upclient.pid";
char cfg_pidfile[PIDFILE_MAXLEN+1] = PIDFILE;
char cfg_proxyserver[PROXYSERVER_MAXLEN+1] = "";
int cfg_proxyport = 8080;
char cfg_proxyuser[PROXYUSER_MAXLEN+1] = "";
int cfg_udpport = 49153;

View File

@ -1,6 +1,6 @@
--- 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 @@
--- src/options.h.orig Mon Sep 30 02:58:36 2002
+++ src/options.h Sat Oct 19 22:55:19 2002
@@ -60,11 +60,7 @@
extern char cfg_proxyuser[PROXYUSER_MAXLEN+1];
extern char cfg_proxypass[PROXYPASS_MAXLEN+1];
extern int cfg_sendidle;

View File

@ -1,33 +1,108 @@
--- 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 @@
--- src/stats-bsd.c.orig Mon Sep 30 02:58:36 2002
+++ src/stats-bsd.c Sat Oct 19 22:50:30 2002
@@ -41,139 +41,171 @@
#include "upclient.h"
#include "options.h"
#include "stats.h"
-#include "uplog.h" /* wrapper for <syslog.h> */
/* System includes */
-#include <kvm.h>
-#include <stdio.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <kvm.h>
#include <limits.h>
-#include <sys/time.h>
-#include <sys/param.h>
+#include <stdio.h>
+#include <syslog.h>
#include <sys/dkstat.h>
+#include <sys/param.h>
#include <sys/sysctl.h>
+#include <sys/time.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];
- /* Get uptime */
- time(&now);
-void getstats(unsigned long *puptime, double *pload, int *pidle, char *os, char *oslevel, char *cpu) {
- struct utsname uts;
- struct timeval boottime;
+void
+getstats(unsigned long *puptime, double *pload, int *pidle,
+ char *os, char *oslevel, char *cpu)
+{
+ size_t size;
+ int mib[2];
+
+ { /* ========== uptime ========== */
+ static struct timeval boottime;
+ static int initialized = 0;
+ time_t now;
time_t now;
- size_t size;
- double loadavgs[2];
- int mib[2];
-
- /* 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 (cfg_sendos) {
- /* Get os info */
- uname(&uts);
- }
-
- if (cfg_sendcpu) {
- /* Get CPU info */
- mib[0] = CTL_HW;
- if (cfg_sendcpulevel == 1) {
- mib[1] = HW_MACHINE; /* Send architecture */
- }
- else {
- mib[1] = HW_MODEL; /* Send architecture's specific model */
- }
- size = CPU_SIZE;
- sysctl(mib, 2, cpu, &size, NULL, 0);
- }
-
- if (cfg_sendos) {
- strncpy(os, uts.sysname, OS_SIZE - 1);
- if (cfg_sendoslevel) {
- strncpy(oslevel, uts.release, OSLEVEL_SIZE - 1);
- }
- }
-
- if (cfg_sendidle) {
- static kvm_t *kp;
- static int initialized = 0;
- static struct nlist namelist [] = {
+
+ if (!initialized) {
+ initialized = 1;
+
mib[0] = CTL_KERN;
mib[1] = KERN_BOOTTIME;
size = sizeof(boottime);
- if(sysctl(mib, 2, &boottime, &size, NULL, 0) != -1 && (boottime.tv_sec != 0)) {
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_BOOTTIME;
+ size = sizeof(boottime);
+
+ if (sysctl (mib, 2, &boottime, &size, NULL, 0) == -1)
+ err (1, "sysctl: kern.boottime");
+ if (sysctl(mib, 2, &boottime, &size, NULL, 0) == -1) {
+ uplog(LOG_ERR, "sysctl: kern.boottime");
+ err(1, "sysctl: kern.boottime");
+ }
+ }
+
+ if (boottime.tv_sec) {
@ -35,52 +110,43 @@
+
+ time (&now);
+
*puptime = now - boottime.tv_sec;
*puptime /= 60;
}
+ *puptime = now - boottime.tv_sec;
+ *puptime /= 60;
+ }
+ }
+
+ if(cfg_sendload) { /* ========== loadavg ========== */
+ 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] = "";
+
+ getloadavg(loadavgs, 3);
+ /* Use the 3rd element (15 minute load average) */
+ *pload = loadavgs[2];
+ }
+
+ if (cfg_sendcpu) { /* ========== cpu ========== */
+ static char buf[CPU_SIZE] = "";
+ static int initialized = 0;
+
+ if (!initialized) {
+ initialized = 1;
- if(cfg_sendcpu) {
- /* Get CPU info */
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 (sysctl (mib, 2, buf, &size, NULL, 0) == -1)
+ warn ("sysctl: hw.model");
+ mib[0] = CTL_HW;
+ if (cfg_sendcpulevel == 1)
+ mib[1] = HW_MACHINE; /* Send architecture */
+ else
+ mib[1] = HW_MODEL; /* Send architecture's specific model */
+ size = CPU_SIZE;
+
+ if (sysctl(mib, 2, buf, &size, NULL, 0) == -1) {
+ uplog(LOG_WARNING, "sysctl: hw.model");
+ /* warn("sysctl: hw.model"); */
+ }
+ }
+
+ strncpy (cpu, buf, CPU_SIZE);
+ cpu [CPU_SIZE - 1] = 0;
}
if(cfg_sendos) {
+ strlcpy(cpu, buf, CPU_SIZE);
+ }
+
+ if (cfg_sendos) {
+ static struct utsname uts;
+ static int initialized = 0;
+
@ -90,17 +156,139 @@
+ uname(&uts);
+ }
+
strncpy(os, uts.sysname, OS_SIZE - 1);
+ os [OS_SIZE - 1] = 0;
+ strlcpy(os, uts.sysname, OS_SIZE);
+
if(cfg_sendoslevel) {
strncpy(oslevel, uts.release, OSLEVEL_SIZE - 1);
+ oslevel [OSLEVEL_SIZE - 1] = 0;
+ if (cfg_sendoslevel)
+ strlcpy(oslevel, uts.release, OSLEVEL_SIZE);
+ }
+
+ if (cfg_sendidle) { /* ========== idle_time ========== */
+ static kvm_t *kp;
+ static int initialized = 0;
+ static struct nlist namelist[] = {
#define X_CP_TIME 0
- { "_cp_time" },
- { NULL },
- };
-
- if (!initialized) {
- char errbuf[_POSIX2_LINE_MAX];
- initialized = 1;
-
- setgid(getgid());
-
- kp = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf);
-
- if (!kp) {
- uplog(LOG_WARNING, "kvm_openfiles: %s. (Did you forget to start upclient as root?)", errbuf);
-// warn("kvm_openfiles: %s", errbuf);
- }
- else if (kvm_nlist(kp,namelist) == -1) {
- uplog(LOG_WARNING, "kvm_nlist: %s", kvm_geterr(kp));
-// 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) {
- uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp));
-// warn("kvm_read: %s", kvm_geterr(kp));
- }
- else
- sleep(1); /* to avoid the initial 0 idle value */
- }
-
- if (kvm_read(kp, namelist[X_CP_TIME].n_value, ctime, sizeof(ctime)) == -1) {
- uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp));
-// 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;
- }
+ { "_cp_time" },
+ { NULL },
+ };
+
+ if (!initialized) {
+ char errbuf[_POSIX2_LINE_MAX];
+ initialized = 1;
+
+ setgid(getgid());
+
+ kp = kvm_openfiles(NULL,NULL,NULL,O_RDONLY,errbuf);
+
+ if (!kp) {
+ uplog(LOG_WARNING, "kvm_openfiles: %s",errbuf);
+ /* warn("kvm_openfiles: %s",errbuf); */
+ } else if (kvm_nlist(kp,namelist) == -1) {
+ uplog(LOG_WARNING, "kvm_nlist: %s",kvm_geterr(kp));
+ /* 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) {
+ uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp));
+ /* warn("kvm_read: %s", kvm_geterr(kp)); */
+ } else
+ sleep(1); /* to avoid the initial 0 idle value */
+ }
+
+ if (kvm_read(kp, namelist[X_CP_TIME].n_value,
+ ctime, sizeof(ctime)) == -1) {
+ uplog(LOG_WARNING, "kvm_read: %s", kvm_geterr(kp));
+ /* 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_sendidle) {
+ if(cfg_sendidle) { /* ========== idle_time ========== */
static kvm_t *kp;
static int initialized = 0;
static struct nlist namelist [] = {
+ }
}
-#endif /* PLATFORM_BSD */
+
+#endif /* PLATFORM_BSD */

View File

@ -1,5 +1,5 @@
--- scripts/upchk.orig Fri Jun 1 01:30:24 2001
+++ scripts/upchk Sun Nov 18 16:45:59 2001
--- scripts/upchk.orig Mon Sep 23 19:28:31 2002
+++ scripts/upchk Sat Oct 19 22:52:27 2002
@@ -24,7 +24,7 @@
#

View File

@ -9,6 +9,7 @@ sbin/upclient
%%PORTDOCS%%share/doc/upclient/COPYING
%%PORTDOCS%%share/doc/upclient/FAQ
%%PORTDOCS%%share/doc/upclient/HISTORY
%%PORTDOCS%%share/doc/upclient/HISTORY-BETA
%%PORTDOCS%%share/doc/upclient/INSTALL
%%PORTDOCS%%share/doc/upclient/README
%%PORTDOCS%%share/doc/upclient/TODO