diff --git a/sysutils/apcupsd/Makefile b/sysutils/apcupsd/Makefile new file mode 100644 index 000000000000..674273254a0f --- /dev/null +++ b/sysutils/apcupsd/Makefile @@ -0,0 +1,29 @@ +# $NetBSD: Makefile,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ +# + +DISTNAME= apcupsd-3.5.8.src +PKGNAME= apcupsd-3.5.8 +CATEGORIES= sysutils +MASTER_SITES= ftp://sunsite.unc.edu/pub/linux/system/ups/ + +MAINTAINER= bouyer@netbsd.org +HOMEPAGE= http://www.brisse.dk/site/apcupsd/ + +USE_GMAKE= yes + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/apcupsd-netbsd ${PREFIX}/sbin/apcupsd + ${INSTALL_PROGRAM} ${WRKSRC}/apcaccess-netbsd ${PREFIX}/bin/apcaccess + ${SED} -e 's|@@PREFIX@@|${PREFIX}|' ${WRKSRC}/installs/powersc > \ + ${WRKDIR}/powersc + ${INSTALL_SCRIPT} ${WRKDIR}/powersc ${PREFIX}/sbin/ + ${SED} -e 's|@@PREFIX@@|${PREFIX}|' ${WRKSRC}/installs/apcupsd.conf > \ + ${WRKDIR}/apcupsd.conf.sample + ${INSTALL_DATA} ${WRKDIR}/apcupsd.conf.sample ${PREFIX}/etc/ + @${MKDIR} ${PREFIX}/share/doc/apcupsd + ${INSTALL_DATA} ${WRKSRC}/readmes/README* \ + ${WRKSRC}/readmes/minicom.apcupsd ${PREFIX}/share/doc/apcupsd/ + ${SED} -e 's|@@PREFIX@@|${PREFIX}|' ${WRKSRC}/docs/apcupsd.man8 > \ + ${WRKDIR}/apcupsd.8 + ${INSTALL_MAN} ${WRKDIR}/apcupsd.8 ${PREFIX}/man/man8/ +.include "../../mk/bsd.pkg.mk" diff --git a/sysutils/apcupsd/files/md5 b/sysutils/apcupsd/files/md5 new file mode 100644 index 000000000000..7d5c385ebb7d --- /dev/null +++ b/sysutils/apcupsd/files/md5 @@ -0,0 +1,3 @@ +$NetBSD: md5,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +MD5 (apcupsd-3.5.8.src.tar.gz) = ced9e22844bd9b490bb5ec7dbed8b014 diff --git a/sysutils/apcupsd/patches/patch-aa b/sysutils/apcupsd/patches/patch-aa new file mode 100644 index 000000000000..4a09c56e0893 --- /dev/null +++ b/sysutils/apcupsd/patches/patch-aa @@ -0,0 +1,52 @@ +$NetBSD: patch-aa,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- Makefile.orig Wed Apr 7 18:06:41 1999 ++++ Makefile Tue Jul 20 18:36:50 1999 +@@ -85,7 +85,7 @@ + + SHELL = /bin/sh + ECHO = echo +-MAKE = make ++MAKE ?= make + CHOWN = chown + CHMOD = chmod + CP = cp +@@ -120,6 +120,7 @@ + #* * + #**************************************************************************** + ++all: netbsd + default : + @$(ECHO) + @$(ECHO) "Usage: make " +@@ -201,7 +202,7 @@ + @$(ECHO) >> .ver + @$(ECHO) \#ifndef __$(OS)__ >> .ver + @$(ECHO) \#define __$(OS)__ >> .ver +- @$(ECHO) \#endif /*\ __$(OS)__ *\/ >> .ver ++ @$(ECHO) \#endif /*\ __$(OS)__\ \*\/ >> .ver + @$(ECHO) >> .ver + @if [ -d /usr/include/ncurses ]; then \ + if [ -f /usr/include/ncurses/curses.h ]; then \ +@@ -227,7 +228,7 @@ + $(ECHO) \#undef __CURSES__ >> .ver; \ + fi + @$(ECHO) >> .ver +- @$(ECHO) \#endif /*\_APC_VERSION_H *\/ >> .ver ++ @$(ECHO) \#endif /*\_APC_VERSION_H\ \*\/ >> .ver + @$(MV) -f .ver $@ + + ifdef MUSIC +@@ -301,6 +302,12 @@ + @$(MAKE) depend $(APCUPSD) \ + OS="freebsd" \ + CC="cc" ++ ++netbsd : ++ @$(MAKE) depend $(APCUPSD) \ ++ OS="netbsd" \ ++ CC="cc" ++ + + # Generic: Generic BSD-ish system running gcc + diff --git a/sysutils/apcupsd/patches/patch-ab b/sysutils/apcupsd/patches/patch-ab new file mode 100644 index 000000000000..915b2e682e24 --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ab @@ -0,0 +1,14 @@ +$NetBSD: patch-ab,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- apcaction.c Wed Apr 7 18:06:41 1999 ++++ apcaction.c Sun Jul 18 19:48:13 1999 +@@ -59,7 +59,9 @@ + + #include + #include ++#ifndef __NetBSD__ + #include ++#endif /* __NetBSD__ */ + #include + #include + #include diff --git a/sysutils/apcupsd/patches/patch-ac b/sysutils/apcupsd/patches/patch-ac new file mode 100644 index 000000000000..06d2539ee3ff --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ac @@ -0,0 +1,20 @@ +$NetBSD: patch-ac,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- apchttp.c Wed Apr 7 18:06:41 1999 ++++ apchttp.c Sun Jul 18 19:50:58 1999 +@@ -70,7 +70,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -80,6 +79,7 @@ + #include + #include + #include ++#include + + /* apc includes */ + #include diff --git a/sysutils/apcupsd/patches/patch-ad b/sysutils/apcupsd/patches/patch-ad new file mode 100644 index 000000000000..1176564e804e --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ad @@ -0,0 +1,14 @@ +$NetBSD: patch-ad,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- apcreports.c Wed Apr 7 18:06:41 1999 ++++ apcreports.c Sun Jul 18 19:48:17 1999 +@@ -58,7 +58,9 @@ + + #include + #include ++#ifndef __NetBSD__ + #include ++#endif /* __NetBSD__ */ + #include + #include + #include diff --git a/sysutils/apcupsd/patches/patch-ae b/sysutils/apcupsd/patches/patch-ae new file mode 100644 index 000000000000..0249bb795b5a --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ae @@ -0,0 +1,73 @@ +$NetBSD: patch-ae,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- apcserial.c.orig Wed Apr 7 18:06:41 1999 ++++ apcserial.c Fri Jan 7 18:54:39 2000 +@@ -59,7 +59,9 @@ + + #include + #include ++#ifndef __NetBSD__ + #include ++#endif /* __NetBSD__ */ + #include + #include + #include +@@ -135,10 +137,10 @@ + newtio.c_oflag = 0; /* Raw output */ + newtio.c_lflag = 0; /* No local echo */ + +-#ifdef __freebsd__ ++#if defined(__freebsd__) || defined (__NetBSD__) + newtio.c_ispeed = DEFAULT_SPEED; /* Set input speed */ + newtio.c_ospeed = DEFAULT_SPEED; /* Set output speed */ +-#endif /* __freebsd__ */ ++#endif /* __freebsd__ || __NetBSD__ */ + + /* w.p. This makes a non.blocking read() with 5 sec. timeout */ + newtio.c_cc[VMIN] = 0; +@@ -195,7 +197,6 @@ + { + char response[32]; /* w.p. */ + char a; +- FILE *pwdf; + int errflag = 0; + response[0] = '\0'; + +@@ -230,19 +231,6 @@ + } + } + } +- if ((((pwdf = fopen(PWRFAIL, "r" )) == NULL) && +- (ups->mode.type != BK)) || +- (((pwdf = fopen(PWRFAIL, "r" )) == NULL) && +- (ups->LineUp != 0) && (ups->mode.type == BK))) { +- fprintf(stderr, +- "%s: Attempting to kill the power!\n" \ +- "%s: Nice TRY but not TODAY!\n" \ +- "%s: Shutdown not called first.\n" \ +- "%s: Bug found by Tom Kunicki\n", +- ups->argvalue, ups->argvalue, +- ups->argvalue, ups->argvalue); +- terminate(0); +- } else { + errflag=0; /* w.p. */ + if ((ups->class.type == SHAREMASTER) || + (ups->class.type == SHARENETMASTER)) { +@@ -259,7 +247,6 @@ + ups->argvalue); + sleep(15); + } +- fclose(pwdf); + + fprintf(stderr, + "%s: Attempting to kill the power!\n", +@@ -407,9 +394,7 @@ + } + } + /* w.p. */ +- sleep(10); + terminate(0); +- } + } else { + if (ups->mode.type <= SHAREBASIC) { + switch(ups->cable.type) { diff --git a/sysutils/apcupsd/patches/patch-af b/sysutils/apcupsd/patches/patch-af new file mode 100644 index 000000000000..3705c241ef33 --- /dev/null +++ b/sysutils/apcupsd/patches/patch-af @@ -0,0 +1,28 @@ +$NetBSD: patch-af,v 1.1.1.1 2000/01/21 19:15:59 bouyer Exp $ + +--- apcupsd.c.orig Wed Apr 7 18:06:41 1999 ++++ apcupsd.c Fri Jan 7 18:55:53 2000 +@@ -100,7 +100,9 @@ + + #include + #include ++#ifndef __NetBSD__ + #include ++#endif /* __NetBSD__ */ + #include + #include + #include +@@ -290,13 +292,6 @@ + * it should close them. + *********************************************************************/ + void terminate (int sig) { +- /* +- * XXX - Is someone able to explain me why here we find a sleep for 10 +- * seconds ? +- * +- * -RF +- */ +- sleep(10); + #ifdef NEW_THREADS + restore_signals(); + #endif /* NEW_THREADS */ diff --git a/sysutils/apcupsd/patches/patch-ag b/sysutils/apcupsd/patches/patch-ag new file mode 100644 index 000000000000..9f43787d0623 --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ag @@ -0,0 +1,17 @@ +$NetBSD: patch-ag,v 1.1.1.1 2000/01/21 19:16:00 bouyer Exp $ + +--- include/apc_defines.h Wed Apr 7 18:06:41 1999 ++++ nclude/apc_defines.h Sun Jul 18 19:45:49 1999 +@@ -66,6 +66,12 @@ + #define PWRFAIL "/var/run/powerfail" + #endif /* __freebsd__ */ + ++#ifdef __NetBSD__ ++#define APCCONF "/etc/apcupsd.conf" ++#define UPS_STAT "/var/log/apcupsd.status" ++#define PWRFAIL "/var/run/powerfail" ++#endif /* __NetBSD__ */ ++ + #ifndef APCCONF + #define APCCONF "/etc/apcupsd.conf" + #endif diff --git a/sysutils/apcupsd/patches/patch-ah b/sysutils/apcupsd/patches/patch-ah new file mode 100644 index 000000000000..3bedac48936a --- /dev/null +++ b/sysutils/apcupsd/patches/patch-ah @@ -0,0 +1,75 @@ +$NetBSD: patch-ah,v 1.1.1.1 2000/01/21 19:16:00 bouyer Exp $ + +--- docs/apcupsd.man8.orig Wed Apr 7 18:06:41 1999 ++++ docs/apcupsd.man8 Tue Jul 20 19:27:28 1999 +@@ -8,13 +8,13 @@ + .SH NAME + apcupsd \- daemon for Most APCC's UPS support under Linux and UNIX + .SH SYNOPSIS +-.B /sbin/apcupsd ++.B @@PREFIX@@/sbin/apcupsd + .br +-.B /sbin/powersc ++.B @@PREFIX@@/sbin/powersc + .br + .B /etc/apcupsd.conf + .br +-.B /sbin/apcaccess ++.B @@PREFIX@@/bin/apcaccess + .SH DESCRIPTION + .LP + This daemon can be used for controlling the APC SmartUPS. During a power +@@ -23,7 +23,7 @@ + about this fact. If power is not restored, a system shutdown will follow + when the battery is exausted, a timeout (seconds) expires, or runtime + minutes based on internal values based on power consumption rates. The +-whole shutdown is now made by script calls to the "/sbin/powersc" ++whole shutdown is now made by script calls to the "@@PREFIX@@/sbin/powersc" + file called by "apcupsd", so no changes in the inittab are necessary. + There is now no communication between "apcupsd" and init(1) process. + .LP +@@ -46,7 +46,7 @@ + .SH CONFIGURATION + It is necessary to write configuration info to the file "/etc/apcupsd.conf". + This file is a plain ASCII file and you can use your favorite editor for +-configuration. For simple configuration, see enclosed sample file. ++configuration. For simple configuration, see sample file in @@PREFIX@@/etc + .LP + Configuration commands in + .B /etc/apcupsd.conf +@@ -54,7 +54,7 @@ + .LP + .B CONTROL + -- +-.B /sbin/powersc ++.B @@PREFIX@@/sbin/powersc + .br + Name of control script called by "apcupsd". + .LP +@@ -123,7 +123,7 @@ + -- + .br + Please specify which device is used for UPS communication. +-The default is /dev/ttyS[0|1|2|3]. ++The default is /dev/tty0[0|1|2|3]. + .LP + .B LOCKFILE + -- +@@ -165,7 +165,7 @@ + --