Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 May 2000 14:35:01 -0400 (EDT)
From:      jim@thehousleys.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/18401: New Port: misc/upclient-4.09
Message-ID:  <200005051835.OAA51342@baby.int.thehousleys.net>

next in thread | raw e-mail | index | archive | help

>Number:         18401
>Category:       ports
>Synopsis:       New Port: misc/upclient-4.09
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 07 01:10:02 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     James Housley
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
The Housleys dot Net
>Environment:

	

>Description:

	This is a port of www.uptimes.net upclient-4.09 to FreeBSD.
	It is in the misc/upclient4 directory, but misc/upclient
	is marked broken and I would have no problem with this replacing
	that one.

>How-To-Repeat:

	

>Fix:
	

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	upclient4
#	upclient4/files
#	upclient4/files/md5
#	upclient4/patches
#	upclient4/patches/patch-aa
#	upclient4/patches/patch-ab
#	upclient4/patches/patch-ac
#	upclient4/pkg
#	upclient4/pkg/COMMENT
#	upclient4/pkg/DESCR
#	upclient4/pkg/MESSAGE
#	upclient4/pkg/PLIST
#	upclient4/Makefile
#
echo c - upclient4
mkdir -p upclient4 > /dev/null 2>&1
echo c - upclient4/files
mkdir -p upclient4/files > /dev/null 2>&1
echo x - upclient4/files/md5
sed 's/^X//' >upclient4/files/md5 << 'END-of-upclient4/files/md5'
XMD5 (upclient-4.09.tar.gz) = 9bf44128c2b24df3e88afe7b10a50e73
END-of-upclient4/files/md5
echo c - upclient4/patches
mkdir -p upclient4/patches > /dev/null 2>&1
echo x - upclient4/patches/patch-aa
sed 's/^X//' >upclient4/patches/patch-aa << 'END-of-upclient4/patches/patch-aa'
X--- Makefile	Sun Jan 23 10:53:15 2000
X+++ Makefile	Fri Feb 25 17:58:46 2000
X@@ -10,5 +10,17 @@
X # Uncomment for Solaris
X #OPTS = -lsocket -lnsl
X 
X+IDINFO = -DLOGINNAME="\"${myUSER}\"" -DPASSWORD="\"${myPASS}\""
X+
X+all: upclient
X+
X upclient: upclient.c config.h
X-	$(CC) $(OPTS) -Wall -o upclient upclient.c
X+	$(CC) $(OPTS) $(IDINFO) -Wall -o upclient upclient.c
X+
X+clean:
X+	rm upclient
X+
X+install: upclient
X+	$(INSTALL) -o root -g kmem -m 2755 -c -p upclient /usr/local/sbin
X+	$(INSTALL) -o root -g wheel -m 755 -c -p upchk /usr/local/sbin
X+
END-of-upclient4/patches/patch-aa
echo x - upclient4/patches/patch-ab
sed 's/^X//' >upclient4/patches/patch-ab << 'END-of-upclient4/patches/patch-ab'
X--- config.h	Sun Feb 13 19:00:58 2000
X+++ config.h	Fri Feb 25 17:56:10 2000
X@@ -16,6 +16,7 @@
X  * UnixWare --> #define PLATFORM_CODE  2
X  * Ultrix   --> #define PLATFORM_CODE  3
X  * Solaris  --> #define PLATFORM_CODE  4
X+ * FreeBSD  --> #define PLATFORM_CODE  5
X  */
X #define PLATFORM_CODE		-1
X 
X@@ -29,6 +30,8 @@
X #	define PLATFORM_ULTRIX
X #elif (PLATFORM_CODE == 4)
X #	define PLATFORM_SOLARIS
X+#elif (PLATFORM_CODE == 5) || defined(__FreeBSD__)
X+#	define PLATFORM_FREEBSD
X #else
X #	error "You need to define your PLATFORM, pal."
X #endif
X@@ -50,8 +53,10 @@
X  * If you haven't registered yourself yet, go to
X  * http://www.uptimes.net/register.html
X  */
X+/*
X #define LOGINNAME		"Enter your loginname here"
X #define PASSWORD		"Enter your password here"
X+*/
X 
X 
X 
X@@ -126,7 +133,7 @@
X  *
X  * Where should the client write it's pidfile?
X  */
X-#define PIDFILE			"<path-to>/upclient.pid"
X+#define PIDFILE			"/var/run/upclient.pid"
X 
X 
X 
END-of-upclient4/patches/patch-ab
echo x - upclient4/patches/patch-ac
sed 's/^X//' >upclient4/patches/patch-ac << 'END-of-upclient4/patches/patch-ac'
X--- ../upclient-4.09.orig/upclient.c	Sun Feb 13 19:00:51 2000
X+++ upclient.c	Mon Mar 20 09:37:22 2000
X@@ -37,7 +37,16 @@
X #ifdef PLATFORM_BSD
X #include <sys/param.h>
X #include <sys/sysctl.h>
X-#endif
X+#endif /* PLATFORM_BSD */
X+
X+#ifdef PLATFORM_FREEBSD
X+#include <sys/param.h>
X+#include <sys/sysctl.h>
X+#include <nlist.h>
X+#include <stab.h>
X+#include <fcntl.h>
X+#include <grp.h>
X+#endif /* PLATFORM_FREEBSD */
X 
X #ifdef PLATFORM_ULTRIX
X #include <fcntl.h>
X@@ -320,6 +329,80 @@
X 
X #ifdef SEND_CPU
X 	strncpy (cpu, uts.machine, CPU_SIZE - 1);
X+#endif
X+}
X+#endif
X+
X+#if defined(PLATFORM_FREEBSD)
X+void getstats(unsigned long* puptime, double* pload, int* pidle, char* os, char* oslevel, char* cpu) {
X+	struct utsname uts;
X+	struct timeval boottime;
X+	time_t now;
X+	size_t size;
X+	double loadavgs[2];
X+	int mib[2];
X+	char *cputype;
X+	int ncpu;
X+	int smpcpus;
X+
X+	/* Get uptime */
X+	time (&now);
X+	mib[0] = CTL_KERN;
X+	mib[1] = KERN_BOOTTIME;
X+	size = sizeof (boottime);
X+	if (sysctl (mib, 2, &boottime, &size, NULL, 0) != -1 &&	(boottime.tv_sec != 0)) {
X+		*puptime = now - boottime.tv_sec;
X+		*puptime /= 60;
X+	}
X+
X+#ifdef SEND_LOADAVG
X+	/* Get load average */
X+	getloadavg(loadavgs, 3);
X+	/* Use the 3rd element (15 minute load average) */
X+	*pload = loadavgs[2];
X+#endif
X+
X+#if defined(SEND_OS)
X+	/* Get os info */
X+	uname (&uts);
X+#elif defined(SEND_CPU)
X+	/* Get CPU info */
X+	uname (&uts);
X+#endif
X+
X+#if defined(SEND_OS)
X+	strncpy (os, uts.sysname, OS_SIZE - 1);
X+#if defined(SEND_OSLEVEL)
X+	strncpy (oslevel, uts.release, OSLEVEL_SIZE - 1);
X+#endif
X+#endif
X+
X+#ifdef SEND_CPU
X+	mib[0] = CTL_HW;
X+	mib[1] = HW_NCPU;
X+	size = sizeof(ncpu);
X+	sysctl(mib, 2, &ncpu, &size, NULL, 0);
X+
X+	mib[1] = HW_MODEL;
X+	sysctl(mib, 2, NULL, &size, NULL, 0);
X+	cputype = (char *)malloc(size);
X+	sysctl(mib, 2, cputype, &size, NULL, 0);
X+	if (ncpu > 1) {
X+		size = sizeof(smpcpus);
X+		mib[0] = sysctlbyname("machdep.smp_active", &smpcpus, &size, NULL, 0);
X+		if (mib[0] == 0) {
X+			if (smpcpus == 1) {
X+				mib[0] = sysctlbyname("machdep.smp_cpus", &smpcpus, &size, NULL, 0);
X+				snprintf(cpu, CPU_SIZE-1, "%s-SMPx%d", cputype, smpcpus);
X+			} else {
X+				snprintf(cpu, CPU_SIZE-1, "%s-UPx%d", cputype, ncpu);
X+			}
X+		} else {
X+			snprintf(cpu, CPU_SIZE-1, "%s-UPx%d", cputype, ncpu);
X+		}
X+	} else {
X+		snprintf(cpu, CPU_SIZE-1, "%s", cputype);
X+	}
X #endif
X }
X #endif
END-of-upclient4/patches/patch-ac
echo c - upclient4/pkg
mkdir -p upclient4/pkg > /dev/null 2>&1
echo x - upclient4/pkg/COMMENT
sed 's/^X//' >upclient4/pkg/COMMENT << 'END-of-upclient4/pkg/COMMENT'
XThe Server Uptimes project client
END-of-upclient4/pkg/COMMENT
echo x - upclient4/pkg/DESCR
sed 's/^X//' >upclient4/pkg/DESCR << 'END-of-upclient4/pkg/DESCR'
XThis is the client program for the Server Uptimes project.
XFor more information on the Server Uptimes project visit their web site at:
X
XWWW: http://www.uptimes.net/
X
X- Jim
Xjim@thehousleys.net
END-of-upclient4/pkg/DESCR
echo x - upclient4/pkg/MESSAGE
sed 's/^X//' >upclient4/pkg/MESSAGE << 'END-of-upclient4/pkg/MESSAGE'
XBefore running the client for the first time, be sure to:
X 1. log in (WWW: http://uptime.hexon.cx/login)
X
X 2. Add your host (WWW: http://uptime.hexon.cx/login/cgi-bin/addhost.cgi)
X
XNote that in order to send your uptime information to the uptime server,
Xyou hosts need more-or-less full-time Internet access.
X
END-of-upclient4/pkg/MESSAGE
echo x - upclient4/pkg/PLIST
sed 's/^X//' >upclient4/pkg/PLIST << 'END-of-upclient4/pkg/PLIST'
Xsbin/upclient
Xsbin/upchk
END-of-upclient4/pkg/PLIST
echo x - upclient4/Makefile
sed 's/^X//' >upclient4/Makefile << 'END-of-upclient4/Makefile'
X# New ports collection makefile for:	upclient
X# Date created:		5 May 2000
X# Whom:			James Housley <jim@thehousleys.net>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	upclient
XPORTVERSION=	4.09
XCATEGORIES=	misc
XMASTER_SITES=	ftp://ftp.uptimes.net/pub/uptimes/ \
X		http://ftp.uptimes.net/download/
X
XMAINTAINER=	jim@theousleys.net
X
XNO_PACKAGE=	myUSER and myPASS need to be set at compile time
X
X# Need to define myUSER and myPASS
X.if !defined(myUSER) && !defined(myPASS)
Xpre-build:
X	@${ECHO}
X	@${ECHO} You must set variable myUSER and myPASS to the username
X	@${ECHO} and password you used to register at http://www.uptimes.net
X	@${ECHO}
X	@${FALSE}
X.elif !defined(myUSER)
Xpre-build:
X	@${ECHO}
X	@${ECHO} You must set variable myUSER to the user name you registered
X	@${ECHO} at http://www.uptimes.net
X	@${ECHO}
X	@${FALSE}
X.elif !defined(myPASS)
Xpre-build:
X	@${ECHO}
X	@${ECHO} You must set variable myPASS the password you received when
X	@${ECHO} you registered at http://www.uptimes.net
X	@${ECHO}
X	@${FALSE}
X.endif
X
Xpost-install:
X	@${CAT} ${PKGDIR}/MESSAGE
X
X.include <bsd.port.mk>
END-of-upclient4/Makefile
exit


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005051835.OAA51342>