Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2000 15:40:38 +0900 (JST)
From:      KIRIYAMA Kazuhiko <kiri@pis.toba-cmt.ac.jp>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/20587: Update port: upsd-2.0.1.6
Message-ID:  <200008140640.e7E6eck30091@pis.toba-cmt.ac.jp>

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

>Number:         20587
>Category:       ports
>Synopsis:       Update port: upsd-2.0.1.6
>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 Aug 13 23:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     KIRIYAMA Kazuhiko
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Toba National College of Maritime Technology.
	Department of Electronic Mechanical Engineering
>Environment:
>Description:
Updated the port upsd-2.0.1.6. 

Current modifications are :

(1) let Makefile be selectable for input voltage 100 and 230

Update files are respecively :

[Add] :
sysutils/upsd230/files/100V.patch
sysutils/upsd230/files/230V.patch
sysutils/upsd230/files/upsd.sh
sysutils/upsd230/files/upsd100V.conf
sysutils/upsd230/files/upsd230V.conf
sysutils/upsd230/files/upsdctl
sysutils/upsd230/pkg/MESSAGE
[Delete] :
sysutils/upsd/files/upsd.conf
sysutils/upsd230/patches/patch-ad
I put the diff from ports-current in "Fix:".

Notice:

o Now those diffs are from sysutils/upsd230. So please Repo. cp
  sysutiles/upsd -> sysutiles/upsd230 and then apply pathces. 
o Please commt together with sysutils/ups100

>How-To-Repeat:
>Fix:
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/Makefile sysutils/upsd230/Makefile
--- /usr/ports/tmp.cur/sysutils/upsd230/Makefile	Mon Aug 14 15:20:20 2000
+++ sysutils/upsd230/Makefile	Mon Aug 14 15:21:41 2000
@@ -5,25 +5,42 @@
 # $FreeBSD: ports/sysutils/upsd/Makefile,v 1.6 2000/04/09 19:08:40 cpiazza Exp $
 #
 
-PORTNAME=	upsd
+PORTNAME=	upsd${VOLTAGE}
 PORTVERSION=	2.0.1.6
 CATEGORIES=	sysutils
 MASTER_SITES=	ftp://www.ww.net/pub/wildwind/upsd/ \
 		http://www.cre8tivegroup.com/ \
 		ftp://ftp.sw.ru/pub/unix/upsd/
+DISTFILES=	${DISTNAME:S/${VOLTAGE}//}${EXTRACT_SUFX}
 
 MAINTAINER=	ports@FreeBSD.org
 
 WRKSRC=		${WRKDIR}/upsd-2.0
 
+.if !defined(VOLTAGE)
+VOLTAGE=	230
+.else
+EXTRA_PATCHES=	${FILESDIR}/${VOLTAGE}V.patch
+.if ${VOLTAGE} != 100 && ${VOLTAGE} != 230
+.BEGIN:
+	@${ECHO} "Error: invalid value for VOLTAGE: \"${VOLTAGE}\""
+	@${ECHO} "Possible values are: 100, and 230."
+	@${FALSE}
+.endif
+.endif
+
 pre-build:
 	@${MV} ${WRKSRC}/config.h ${WRKSRC}/conf.h.orig
 	@${SED} -e "s!@prefix@!${PREFIX}!g" ${WRKSRC}/conf.h.orig > ${WRKSRC}/conf.h
 
 post-install:
-	if [ ! -f ${PREFIX}/etc/upsd.conf ] ; then \
-		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \
-			${FILESDIR}/upsd.conf ${PREFIX}/etc/upsd.conf; \
-	fi
+	cd ${FILESDIR}; \
+	${INSTALL_DATA}	upsd${VOLTAGE}V.conf ${PREFIX}/etc/upsd.conf.sample; \
+	if [ ! -f ${PREFIX}/etc/upsd.conf ]; then \
+		${INSTALL_DATA} upsd${VOLTAGE}V.conf ${PREFIX}/etc/upsd.conf; \
+	fi; \
+	${INSTALL_SCRIPT} upsd.sh ${PREFIX}/etc/rc.d/upsd.sh; \
+	${INSTALL_SCRIPT} upsdctl ${PREFIX}/sbin/upsdctl
+	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.mk>
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/100V.patch sysutils/upsd230/files/100V.patch
--- /usr/ports/tmp.cur/sysutils/upsd230/files/100V.patch	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/100V.patch	Wed Aug  9 19:26:18 2000
@@ -0,0 +1,120 @@
+--- apc.h.orig	Sat Aug  3 06:44:22 1996
++++ apc.h	Mon Mar 22 13:56:59 1999
+@@ -66,6 +66,7 @@
+ extern int apc_poll(struct ups_val *);
+ extern int apc_tune(struct ups_val *);
+ 
++extern struct ups_model apc_SmartUPS_100;
+ extern struct ups_model apc_SmartUPS_230;
+ extern struct ups_model apc_SmartUPS_vs_420;
+ extern char apc_SmartUPS_OK[];
+--- apc_static.c.orig	Sat Aug  3 06:44:23 1996
++++ apc_static.c	Tue Aug  8 14:38:44 2000
+@@ -43,7 +43,7 @@
+ 	{SMART_POWERTEST, "power-test", R_COMMAND, 0, T_BINARY, 2+2, 2, "U", 1},
+ 	{SMART_RECHARGE, "recharge", R_STATUS, 0, T_NUMBER, 5+2, 1, "f", 1},
+ 	{SMART_SELFTEST, "self-test", R_COMMAND, 0, T_BINARY, 0, 0, "W", 1},
+-	{SMART_SERIAL, "serial", R_INFO, 0, T_BINARY, 8+2, 2, "n", 1},
++	{SMART_SERIAL, "serial", R_INFO, 0, T_BINARY, 14+2, 2, "n", 1},
+ 	{SMART_SHUTDELAY, "shutdown-delay", R_OPTION, APC_TOGGLE, T_NUMBER, 3+2, 0, "p", 1},
+ 	{SMART_SHUTDOWN, "shutdown", R_COMMAND, APC_WRITE, T_BINARY, 0, 0, "S", 1},
+ 	{SMART_TEMP, "temperature", R_STATUS, 0, T_NUMBER, 5+2, 1, "C", 1},
+@@ -74,6 +74,60 @@
+ 	{0, NULL, 0, 0, 0, 0, 0, NULL, 0}
+ };
+ 
++/* Legal values for SmartUPS(R) 100V units. */
++static struct ups_val apc_SmartUPS_100_values[] = {
++	{SMART_HTPOINT, {number: 105}},
++	{SMART_HTPOINT, {number: 110}},
++	{SMART_HTPOINT, {number: 115}},
++	{SMART_HTPOINT, {number: 120}},
++
++	{SMART_LTPOINT, {number: 80}},
++	{SMART_LTPOINT, {number: 85}},
++	{SMART_LTPOINT, {number: 90}},
++	{SMART_LTPOINT, {number: 95}},
++
++	{SMART_LOWBATDUR, {number: 2}},
++	{SMART_LOWBATDUR, {number: 5}},
++	{SMART_LOWBATDUR, {number: 7}},
++	{SMART_LOWBATDUR, {number: 10}},
++
++	{SMART_WAKEUPBCAP, {number: 0}},
++	{SMART_WAKEUPBCAP, {number: 10}},
++	{SMART_WAKEUPBCAP, {number: 25}},
++	{SMART_WAKEUPBCAP, {number: 90}},
++	{SMART_WAKEUPBCAP, {number: 100}},
++
++	{SMART_WAKEUPDELAY, {number: 0}},
++	{SMART_WAKEUPDELAY, {number: 60}},
++	{SMART_WAKEUPDELAY, {number: 180}},
++	{SMART_WAKEUPDELAY, {number: 300}},
++
++	{SMART_NVOLTAGE, {number: 97}},
++	{SMART_NVOLTAGE, {number: 100}},
++	{SMART_NVOLTAGE, {number: 103}},
++
++	{SMART_SHUTDELAY, {number: 20}},
++	{SMART_SHUTDELAY, {number: 60}},
++	{SMART_SHUTDELAY, {number: 180}},
++	{SMART_SHUTDELAY, {number: 300}},
++	{SMART_SHUTDELAY, {number: 600}},
++
++	{SMART_LINESENS, {binary: "L"}},
++	{SMART_LINESENS, {binary: "M"}},
++	{SMART_LINESENS, {binary: "H"}},
++
++	{SMART_LINEALARM, {binary: "0"}},
++	{SMART_LINEALARM, {binary: "L"}},
++	{SMART_LINEALARM, {binary: "T"}},
++	{SMART_LINEALARM, {binary: "N"}},
++
++	{SMART_LABEL, {binary: NULL}},
++
++	{SMART_BREPL, {binary: NULL}},
++
++	{0, {binary: NULL}}
++};
++
+ /* Legal values for SmartUPS(R) 230V units. */
+ static struct ups_val apc_SmartUPS_230_values[] = {
+ 	{SMART_HTPOINT, {number: 253}},
+@@ -138,6 +192,18 @@
+ 	{SMART_TBLOW, "batteries-low", SMART_TBRST, "%", 1},
+ 	{SMART_TBRST, "batteries-restore", SMART_TBLOW, "+", 1},
+ 	{0, NULL, 0, NULL, 0}
++};
++
++struct ups_model apc_SmartUPS_100 = {
++	"apc-smart",
++	"smart-ups",
++	100,
++	sizeof(apc_SmartUPS_registers)/sizeof(struct ups_reg),
++	apc_SmartUPS_registers,
++	apc_SmartUPS_triggers,
++	apc_SmartUPS_100_values,
++	apc_poll,
++	apc_tune
+ };
+ 
+ struct ups_model apc_SmartUPS_230 = {
+--- upsd.c.orig	Sat Aug  3 06:44:25 1996
++++ upsd.c	Mon Mar 22 15:40:29 1999
+@@ -30,6 +30,7 @@
+ 
+ /* All supported UPS models. */
+ struct ups_model *upslist[] = {
++	&apc_SmartUPS_100,
+ 	&apc_SmartUPS_230,
+ 	&apc_SmartUPS_vs_420,
+ 	NULL
+@@ -111,7 +111,7 @@
+ 	argv += optind;
+ 
+ 	/* Set up the system log. */
+-	openlog(NULL, LOG_CONS | LOG_PID, LOG_DAEMON);
++	openlog("upsd", LOG_CONS | LOG_PID, LOG_DAEMON);
+ 
+ 	/* Configure the daemon. */
+ 	if(configure(_PATH_UPSD_CONF) == -1) {
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/230V.patch sysutils/upsd230/files/230V.patch
--- /usr/ports/tmp.cur/sysutils/upsd230/files/230V.patch	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/230V.patch	Wed Aug  9 19:04:38 2000
@@ -0,0 +1,32 @@
+--- apc.c.orig	Fri Aug  2 23:44:22 1996
++++ apc.c	Tue Dec  8 16:59:03 1998
+@@ -164,12 +164,12 @@
+ 			}
+ 			if((r->type & T_TYPE) == T_BINARY) {
+ 				if(!bcmp(v1.val.binary, v0.val.binary, r->size)) {
+-					syslog(LOG_WARNING, "apc_tune: toggle wraparound");
++					syslog(LOG_WARNING, "apc_tune: toggle wraparound register %s", r->name);
+ 					return 1;
+ 				}
+ 			} else {
+ 				if(v1.val.number == v0.val.number) {
+-					syslog(LOG_WARNING, "apc_tune: toggle wraparound");
++					syslog(LOG_WARNING, "apc_tune: toggle wraparound register %s", r->name);
+ 					return 1;
+ 				}
+ 			}
+--- apc_static.c.orig	Fri Aug  2 23:44:23 1996
++++ apc_static.c	Tue Dec  8 16:56:57 1998
+@@ -91,9 +91,12 @@
+ 	{SMART_LOWBATDUR, {number: 7}},
+ 	{SMART_LOWBATDUR, {number: 10}},
+ 
++	/* several models accept different values here */
+ 	{SMART_WAKEUPBCAP, {number: 0}},
+ 	{SMART_WAKEUPBCAP, {number: 10}},
++	{SMART_WAKEUPBCAP, {number: 15}},
+ 	{SMART_WAKEUPBCAP, {number: 25}},
++	{SMART_WAKEUPBCAP, {number: 50}},
+ 	{SMART_WAKEUPBCAP, {number: 90}},
+ 	{SMART_WAKEUPBCAP, {number: 100}},
+ 
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/upsd.conf sysutils/upsd230/files/upsd.conf
--- /usr/ports/tmp.cur/sysutils/upsd230/files/upsd.conf	Mon Aug 14 15:20:20 2000
+++ sysutils/upsd230/files/upsd.conf	Thu Jan  1 09:00:00 1970
@@ -1,100 +0,0 @@
-# $FreeBSD: ports/sysutils/upsd/files/upsd.conf,v 1.2 1999/08/31 02:00:16 peter Exp $
-#
-# UPS Daemon
-# The Wild Wind Communications, 1995, 1996
-#
-# See file LICENSE for the distribution terms of this software.
-#
-
-ups "smart-ups" (230) proto "apc-smart" {
-	device			"/dev/cuaa0"
-	speed			2400
-	read-timeout		2
-	write-block-size	1
-	write-block-delay	50
-	queue-size		64
-}
-
-every 5 { # check events every 5 seconds
-	nop
-}
-
-on "initialize" != "SM" {
-	poll "initialize"
-	after 60 every 60 {
-		log emerg "Cannot put the UPS into smart mode!"
-	}
-}
-
-every 600 {
-	tune "high-transfer-point"		264
-	tune "low-transfer-point"		196
-	tune "line-alarm"			"0"
-	tune "line-sensitivity"			"L"
-	tune "low-batteries-duration"		2
-	tune "nominal-voltage"			220
-	tune "shutdown-delay"			20
-	tune "wakeup-batteries-capacity"	25
-	tune "wakeup-delay"			0
-#	tune "batteries-replaced"		"01/01/77"
-#	tune "label"				"WildWind"
-}
-
-every 300 {			# poll the UPS
-	poll "last-test"
-#	poll "light-test"
-	poll "line-frequency"
-	poll "line-maxvac"
-	poll "line-minvac"
-	poll "line-voltage"
-	poll "load"
-	poll "recharge"
-	poll "temperature"
-	poll "vdc"
-	poll "voltage"
-
-	log notice "last test: %last-test%, light test: %light-test%"
-	log notice "frequency: %line-frequency%, maxvac: %line-maxvac%, minvac: %line-minvac%, voltage: %line-voltage%"
-	log notice "load: %load%, recharge: %recharge%, temp: %temperature%, vdc: %vdc%, output voltage: %voltage%"
-
-	on "load" > 95 {
-		log alert "UPS load is too high: %load%"
-	}
-}
-
-on "line-fail" {
-	log emerg "*** ALERT! Source power line failed, save your work! ***"
-}
-
-on "line-fail" after 30 {
-	log emerg "*** ALERT! System shutdown in 30 seconds, LOGOUT NOW! ***"
-}
-
-on "line-restore" {
-	log emerg "Source power line restored, you may continue your work."
-}
-
-on "line-fail" after 60 {
-	log emerg "*** ALERT! THE SYSTEM IS SHUTTING DOWN! ***"
-
-	poll "shutdown"
-	poll "shutdown"
-	poll "power-test"
-	poll "power-test"
-	poll "shutdown"
-	poll "shutdown"
-
-	sleep 2
-
-	exec "/sbin/halt &"
-
-	poll "power-test"
-	poll "shutdown"
-	poll "power-test"
-	poll "shutdown"
-	poll "power-test"
-	poll "shutdown"
-	poll "power-test"
-
-	sleep 1000	# let us wait peacefully
-}
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/upsd.sh sysutils/upsd230/files/upsd.sh
--- /usr/ports/tmp.cur/sysutils/upsd230/files/upsd.sh	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/upsd.sh	Tue Mar 23 10:55:26 1999
@@ -0,0 +1,2 @@
+#! /bin/sh
+[ -x /usr/local/sbin/upsdctl ] && /usr/local/sbin/upsdctl start > /dev/null && echo -n ' upsd'
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/upsd100V.conf sysutils/upsd230/files/upsd100V.conf
--- /usr/ports/tmp.cur/sysutils/upsd230/files/upsd100V.conf	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/upsd100V.conf	Sat Aug 12 19:31:41 2000
@@ -0,0 +1,108 @@
+# $Id: upsd.conf,v 2.0 1996/01/28 11:50:37 alexis Exp $
+#
+# UPS Daemon
+# The Wild Wind Communications, 1995, 1996
+#
+# See file LICENSE for the distribution terms of this software.
+#
+
+ups "smart-ups" (100) proto "apc-smart" {
+        device                  "/dev/cuaa0"
+        speed                   2400
+        read-timeout            2
+        write-block-size        1
+        write-block-delay       50
+        queue-size              64
+}
+
+
+every 5 {# check events every 5 seconds
+        nop
+}
+
+on "initialize" != "SM" {
+        poll "initialize"
+        poll "copyright"
+        poll "firmware"
+        poll "serial"
+        poll "manufactured"
+        poll "batteries-replaced"
+        log notice "Copyright %copyright% firmware %firmware% serial no. %serial% manufactured %manufactured% battery replace %batteries-replaced%"
+        after 60 every 60 {
+                log emerg "Cannot put the UPS into smart mode!"
+        }
+}
+
+every 600 {
+	tune "high-transfer-point"		110	# 105,110,115,120(V)
+	tune "low-transfer-point"		90	# 80,85,90,95(V)
+	tune "line-alarm"			"0"	# 0,L,T,N
+	tune "line-sensitivity"			"L"	# L,M,H
+	tune "low-batteries-duration"		2	# 2,5,7,10(min)
+	tune "nominal-voltage"			100	# 97,100,103(V)
+	tune "shutdown-delay"			20	# 20,60,180,300,600(sec)
+	tune "wakeup-batteries-capacity"	10	# 0,10,25,90,100(%)
+	tune "wakeup-delay"			0	# 0,60,180,300(sec)
+#       tune "batteries-replaced"               "01/01/77"
+#       tune "label"                            "WildWind"
+}
+
+every 600 {                     # poll the UPS
+#       poll "last-test"
+#       poll "light-test"
+        poll "line-frequency"
+        poll "line-maxvac"
+        poll "line-minvac"
+        poll "line-voltage"
+        poll "load"
+        poll "recharge"
+        poll "temperature"
+        poll "vdc"
+        poll "voltage"
+
+#       log notice "last test: %last-test%, light test: %light-test%"
+#       log notice "last test: %last-test%"
+        log notice "frequency: %line-frequency%, maxvac: %line-maxvac%, minvac: %line-minvac%, voltage: %line-voltage%"
+        log notice "load: %load%, recharge: %recharge%, temp: %temperature%, vdc: %vdc%, output voltage: %voltage%"
+
+        on "load" > 95 {
+                log alert "UPS load is too high: %load%"
+        }
+}
+
+on "line-fail" {
+        log emerg "*** ALERT! Source power line failed, save your work! ***"
+}
+
+on "line-fail" after 120 {
+        log emerg "*** ALERT! System shutdown in 60 seconds, LOGOUT NOW! ***"
+}
+
+on "line-restore" {
+        log emerg "Source power line restored, you may continue your work."
+}
+
+on "line-fail" after 180 {
+        log emerg "*** ALERT! THE SYSTEM IS SHUTTING DOWN! ***"
+
+        poll "shutdown"
+        poll "shutdown"
+        poll "power-test"
+        poll "power-test"
+        poll "shutdown"
+        poll "shutdown"
+
+        sleep 2
+
+        exec "/sbin/halt &"
+
+        poll "power-test"
+        poll "shutdown"
+        poll "power-test"
+        poll "shutdown"
+        poll "power-test"
+        poll "shutdown"
+        poll "power-test"
+
+        sleep 1000      # let us wait peacefully
+}
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/upsd230V.conf sysutils/upsd230/files/upsd230V.conf
--- /usr/ports/tmp.cur/sysutils/upsd230/files/upsd230V.conf	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/upsd230V.conf	Wed Aug  9 19:04:38 2000
@@ -0,0 +1,100 @@
+# $FreeBSD: ports/sysutils/upsd/files/upsd.conf,v 1.2 1999/08/31 02:00:16 peter Exp $
+#
+# UPS Daemon
+# The Wild Wind Communications, 1995, 1996
+#
+# See file LICENSE for the distribution terms of this software.
+#
+
+ups "smart-ups" (230) proto "apc-smart" {
+	device			"/dev/cuaa0"
+	speed			2400
+	read-timeout		2
+	write-block-size	1
+	write-block-delay	50
+	queue-size		64
+}
+
+every 5 { # check events every 5 seconds
+	nop
+}
+
+on "initialize" != "SM" {
+	poll "initialize"
+	after 60 every 60 {
+		log emerg "Cannot put the UPS into smart mode!"
+	}
+}
+
+every 600 {
+	tune "high-transfer-point"		264
+	tune "low-transfer-point"		196
+	tune "line-alarm"			"0"
+	tune "line-sensitivity"			"L"
+	tune "low-batteries-duration"		2
+	tune "nominal-voltage"			220
+	tune "shutdown-delay"			20
+	tune "wakeup-batteries-capacity"	25
+	tune "wakeup-delay"			0
+#	tune "batteries-replaced"		"01/01/77"
+#	tune "label"				"WildWind"
+}
+
+every 300 {			# poll the UPS
+	poll "last-test"
+#	poll "light-test"
+	poll "line-frequency"
+	poll "line-maxvac"
+	poll "line-minvac"
+	poll "line-voltage"
+	poll "load"
+	poll "recharge"
+	poll "temperature"
+	poll "vdc"
+	poll "voltage"
+
+	log notice "last test: %last-test%, light test: %light-test%"
+	log notice "frequency: %line-frequency%, maxvac: %line-maxvac%, minvac: %line-minvac%, voltage: %line-voltage%"
+	log notice "load: %load%, recharge: %recharge%, temp: %temperature%, vdc: %vdc%, output voltage: %voltage%"
+
+	on "load" > 95 {
+		log alert "UPS load is too high: %load%"
+	}
+}
+
+on "line-fail" {
+	log emerg "*** ALERT! Source power line failed, save your work! ***"
+}
+
+on "line-fail" after 30 {
+	log emerg "*** ALERT! System shutdown in 30 seconds, LOGOUT NOW! ***"
+}
+
+on "line-restore" {
+	log emerg "Source power line restored, you may continue your work."
+}
+
+on "line-fail" after 60 {
+	log emerg "*** ALERT! THE SYSTEM IS SHUTTING DOWN! ***"
+
+	poll "shutdown"
+	poll "shutdown"
+	poll "power-test"
+	poll "power-test"
+	poll "shutdown"
+	poll "shutdown"
+
+	sleep 2
+
+	exec "/sbin/halt &"
+
+	poll "power-test"
+	poll "shutdown"
+	poll "power-test"
+	poll "shutdown"
+	poll "power-test"
+	poll "shutdown"
+	poll "power-test"
+
+	sleep 1000	# let us wait peacefully
+}
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/files/upsdctl sysutils/upsd230/files/upsdctl
--- /usr/ports/tmp.cur/sysutils/upsd230/files/upsdctl	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/files/upsdctl	Sun Mar 28 12:59:39 1999
@@ -0,0 +1,121 @@
+#! /bin/sh
+#
+# UPS Daemon control script  'upsdctl'
+#	base script is apachectl
+#       created  by shin  1999-03-23
+#       modified by shin  1999-03-28
+#
+# The exit codes returned are:
+#       0 - operation completed successfully
+#       1 - 
+#       2 - usage error
+#       3 - upsd could not be started
+#       4 - upsd could not be stopped
+#       5 - upsd could not be started during a restart
+#       6 - upsd could not be restarted during a restart
+#
+# When multiple arguments are given, only the error from the _last_
+# one is reported.  Run "upsdctl help" for usage info
+
+# the path to your PID file
+PIDFILE=/var/run/upsd.pid
+
+# the path to your upsd binary, including options if necessary
+UPSD=/usr/local/sbin/upsd
+
+#eval `limits -e -C daemon` >/dev/null 2>&1
+
+ERROR=0
+ARGV="$@"
+if [ "x$ARGV" = "x" ] ; then 
+    ARGS="help"
+fi
+
+for ARG in $@ $ARGS; do
+    # check for pidfile
+    if [ -f $PIDFILE ]; then
+        PID=`cat $PIDFILE`
+        PS=`ps -p $PID 2>/dev/null | tail -1 | grep $PID`
+        if [ "x$PS" = "x" ]; then
+            STATUS="upsd (pid $PID?) not running"
+            RUNNING=0
+        else
+            STATUS="upsd (pid $PID) running"
+            RUNNING=1
+        fi
+    else
+        STATUS="upsd (no pid file) not running"
+        RUNNING=0
+    fi
+
+    case $ARG in
+        start)
+            if [ $RUNNING -eq 1 ]; then
+                echo "$0 $ARG: upsd (pid $PID) already running"
+                continue
+            fi
+            if $UPSD; then
+                echo "$0 $ARG: upsd started"
+            else
+                echo "$0 $ARG: upsd could not be started"
+                ERROR=3
+            fi
+            ;;
+        stop)
+            if [ $RUNNING -eq 0 ]; then
+                echo "$0 $ARG: $STATUS"
+                continue
+            fi
+            # 3: QUIT (quit)
+            if kill -3 $PID; then
+                echo "$0 $ARG: upsd stopped"
+            else
+                echo "$0 $ARG: upsd could not be stopped"
+                ERROR=4
+            fi
+            ;;
+        restart)
+            if [ $RUNNING -eq 0 ]; then
+                echo "$0 $ARG: upsd not running, trying to start"
+                if $UPSD; then
+                    echo "$0 $ARG: upsd started"
+                else
+                    echo "$0 $ARG: upsd could not be started"
+                    ERROR=5
+                fi
+            else
+                # 6: ABRT (abort)
+                if kill -6 $PID; then
+                    # restart
+                    $UPSD
+                    echo "$0 $ARG: upsd restarted"
+                else
+                    echo "$0 $ARG: upsd could not be restarted"
+                    ERROR=6
+                fi
+            fi
+            ;;
+        status)
+            echo "$STATUS"
+            ;;
+        *)
+            echo "usage: $0 (start|stop|restart|status|help)"
+            cat <<EOF
+
+start      - start upsd
+stop       - stop upsd
+restart    - restart upsd if running by sending a SIGABRT or start if
+             not running
+status     - dump a short status screen
+help       - this screen
+
+EOF
+        ERROR=2
+    ;;
+
+    esac
+
+done
+
+exit $ERROR
+
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/patches/patch-ad sysutils/upsd230/patches/patch-ad
--- /usr/ports/tmp.cur/sysutils/upsd230/patches/patch-ad	Mon Aug 14 15:20:20 2000
+++ sysutils/upsd230/patches/patch-ad	Thu Jan  1 09:00:00 1970
@@ -1,32 +0,0 @@
---- apc.c.orig	Fri Aug  2 23:44:22 1996
-+++ apc.c	Tue Dec  8 16:59:03 1998
-@@ -164,12 +164,12 @@
- 			}
- 			if((r->type & T_TYPE) == T_BINARY) {
- 				if(!bcmp(v1.val.binary, v0.val.binary, r->size)) {
--					syslog(LOG_WARNING, "apc_tune: toggle wraparound");
-+					syslog(LOG_WARNING, "apc_tune: toggle wraparound register %s", r->name);
- 					return 1;
- 				}
- 			} else {
- 				if(v1.val.number == v0.val.number) {
--					syslog(LOG_WARNING, "apc_tune: toggle wraparound");
-+					syslog(LOG_WARNING, "apc_tune: toggle wraparound register %s", r->name);
- 					return 1;
- 				}
- 			}
---- apc_static.c.orig	Fri Aug  2 23:44:23 1996
-+++ apc_static.c	Tue Dec  8 16:56:57 1998
-@@ -91,9 +91,12 @@
- 	{SMART_LOWBATDUR, {number: 7}},
- 	{SMART_LOWBATDUR, {number: 10}},
- 
-+	/* several models accept different values here */
- 	{SMART_WAKEUPBCAP, {number: 0}},
- 	{SMART_WAKEUPBCAP, {number: 10}},
-+	{SMART_WAKEUPBCAP, {number: 15}},
- 	{SMART_WAKEUPBCAP, {number: 25}},
-+	{SMART_WAKEUPBCAP, {number: 50}},
- 	{SMART_WAKEUPBCAP, {number: 90}},
- 	{SMART_WAKEUPBCAP, {number: 100}},
- 
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/pkg/DESCR sysutils/upsd230/pkg/DESCR
--- /usr/ports/tmp.cur/sysutils/upsd230/pkg/DESCR	Mon Aug 14 15:20:20 2000
+++ sysutils/upsd230/pkg/DESCR	Wed Aug  9 19:49:52 2000
@@ -1,3 +1,8 @@
 upsd is a daemon with flexible configuration which lets you to
 shutdown your system properly when source power line fails and
 measure its frequency, voltage etc
+
+YOU MUST BE SET /usr/local/etc/upsd.conf as you want to configure
+your system environment by copying from sample config file -
+/usr/local/etc/upsd.conf.sample. And execute directly
+/usr/local/etc/rc.d/upsd.sh with root or reboot system.
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/pkg/MESSAGE sysutils/upsd230/pkg/MESSAGE
--- /usr/ports/tmp.cur/sysutils/upsd230/pkg/MESSAGE	Thu Jan  1 09:00:00 1970
+++ sysutils/upsd230/pkg/MESSAGE	Sat Aug 12 19:38:56 2000
@@ -0,0 +1,8 @@
+***********************************************************************
+* YOU MUST BE SET /usr/local/etc/upsd.conf as you want to configure   *
+* your system environment. And then run upsd. You can do all          *
+* as follows :                                                        *
+*  # cp /usr/local/etc/upsd.conf.sample /usr/local/etc/upsd.conf      *
+*  # vi /usr/local/etc/upsd.conf <--edit as your environment          *
+*  # /usr/local/etc/rc.d/upsd.sh                                      *
+***********************************************************************
diff -u -r -x CVS -x work -x *~ -x *.orig -N -I ^# *\$Id.*$ -I ^# \$FreeBSD /usr/ports/tmp.cur/sysutils/upsd230/pkg/PLIST sysutils/upsd230/pkg/PLIST
--- /usr/ports/tmp.cur/sysutils/upsd230/pkg/PLIST	Mon Aug 14 15:20:20 2000
+++ sysutils/upsd230/pkg/PLIST	Mon Aug 14 14:52:37 2000
@@ -1,2 +1,6 @@
-etc/upsd.conf
+@unexec if cmp -s %D/etc/upsd.conf %D/etc/upsd.conf.sample; then rm -f %D/etc/upsd.conf; fi
+etc/upsd.conf.sample
+@exec if [ ! -f %B/upsd.conf ]; then cp %B/%f %B/upsd.conf; fi
+etc/rc.d/upsd.sh
 sbin/upsd
+sbin/upsdctl

>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?200008140640.e7E6eck30091>