diff options
author | Greg Lewis <glewis@FreeBSD.org> | 2004-06-17 16:14:13 +0000 |
---|---|---|
committer | Greg Lewis <glewis@FreeBSD.org> | 2004-06-17 16:14:13 +0000 |
commit | 3b06cdd620a175dcac2e2085d24ff8aa842d36cd (patch) | |
tree | d099b25375ba5d9080b2d18d11cd30a633bd17de /sysutils | |
parent | - Update to 2.0.2, a bugfix release (diff) |
Add a port of PowerMan:
PowerMan is a tool for manipulating remote power control (RPC)
devices from a central location. Several RPC varieties are supported
natively by PowerMan and Expect-like configurability simplifies the
addition of new devices.
WWW: http://www.llnl.gov/linux/powerman/
Notes
Notes:
svn path=/head/; revision=111675
Diffstat (limited to 'sysutils')
23 files changed, 675 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile index 4b4548bc28f4..543bf846ee5d 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -301,6 +301,7 @@ SUBDIR += portdowngrade SUBDIR += portsman SUBDIR += portupgrade + SUBDIR += powerman SUBDIR += prips SUBDIR += procmap SUBDIR += progsreiserfs diff --git a/sysutils/powerman/Makefile b/sysutils/powerman/Makefile new file mode 100644 index 000000000000..dbcb1cee1d87 --- /dev/null +++ b/sysutils/powerman/Makefile @@ -0,0 +1,41 @@ +# New ports collection makefile for: powerman +# Date created: 29 March 2004 +# Whom: Greg Lewis <glewis@FreeBSD.org> +# +# $FreeBSD$ + +PORTNAME= powerman +PORTVERSION= 1.0.19 +CATEGORIES= sysutils +MASTER_SITES= ftp://ftp.llnl.gov/pub/linux/powerman/ +EXTRACT_SUFX= .tgz + +MAINTAINER= glewis@FreeBSD.org +COMMENT= PowerMan is a tool for doing remote power control + +USE_BISON= yes +USE_GMAKE= yes +USE_GETOPT_LONG=yes +USE_RC_SUBR= yes +USE_REINPLACE= yes + +MAKE_ENV+= LDFLAGS="${LDFLAGS}" CPPFLAGS="${CPPFLAGS}" \ + PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \ + PTHREAD_LIBS="${PTHREAD_LIBS}" + +MAN1= powerman.1 +MAN5= powerman.conf.5 +MAN7= powerman-devices.7 +MAN8= powermand.8 + +post-patch: +.for file in ${MAN1} ${MAN5} powermand.1 + @${REINPLACE_CMD} -e "s:%%PREFIX%%:${PREFIX}:" "${WRKSRC}/man/${file}" +.endfor + @${REINPLACE_CMD} -e "s:%%PREFIX%%:${PREFIX}:" \ + "${WRKSRC}/src/powerman.h" + @${REINPLACE_CMD} -e "s:%%PREFIX%%:${PREFIX}:" \ + -e "s:%%RC_SUBR%%:${RC_SUBR}:" \ + "${WRKSRC}/scripts/powerman.init" + +.include <bsd.port.mk> diff --git a/sysutils/powerman/distinfo b/sysutils/powerman/distinfo new file mode 100644 index 000000000000..eee46b26232c --- /dev/null +++ b/sysutils/powerman/distinfo @@ -0,0 +1,2 @@ +MD5 (powerman-1.0.19.tgz) = ee43b5770315cd4320eca9dad7070c8f +SIZE (powerman-1.0.19.tgz) = 144047 diff --git a/sysutils/powerman/files/patch-Makefile b/sysutils/powerman/files/patch-Makefile new file mode 100644 index 000000000000..660e1b2426b8 --- /dev/null +++ b/sysutils/powerman/files/patch-Makefile @@ -0,0 +1,106 @@ +$FreeBSD$ + +--- Makefile.orig Thu Dec 4 08:55:02 2003 ++++ Makefile Tue Mar 30 16:31:45 2004 +@@ -1,20 +1,19 @@ + PROJECT = powerman + VERSION = $(shell perl -ne 'print,exit if s/^\s*VERSION:\s*(\S*).*/\1/i' META) + RELEASE = $(shell perl -ne 'print,exit if s/^\s*RELEASE:\s*(\S*).*/\1/i' META) +-SHELL= /bin/sh +-MAKE= /usr/bin/make +-CC= gcc +-INSTALL= /usr/bin/install -c ++SHELL?= /bin/sh ++CC?= gcc ++INSTALL?=/usr/bin/install -c + mkinstalldirs= $(SHELL) $(top_srcdir)/aux/mkinstalldirs +-CFLAGS= -g -O2 -Wall ++CFLAGS?= -g -O2 -Wall + + top_srcdir = . +-prefix = /usr ++prefix = ${PREFIX} + exec_prefix = ${prefix} + bindir = ${exec_prefix}/bin + sbindir = ${exec_prefix}/sbin +-mandir = $(prefix)/man +-etcdir = /etc ++mandir = ${prefix}/man ++etcdir = ${prefix}/etc + packagedir = ${etcdir}/${PROJECT} + + all: progs tests +@@ -26,40 +25,39 @@ + $(MAKE) -C test + + install: all +- $(mkinstalldirs) $(DESTDIR)$(bindir) +- $(INSTALL) src/powerman $(DESTDIR)$(bindir)/ +- ln -s $(bindir)/powerman $(DESTDIR)$(bindir)/off +- ln -s $(bindir)/powerman $(DESTDIR)$(bindir)/on +- ln -s $(bindir)/powerman $(DESTDIR)$(bindir)/pm +- $(mkinstalldirs) $(DESTDIR)$(sbindir) +- $(INSTALL) src/powermand $(DESTDIR)$(sbindir)/ +- $(mkinstalldirs) $(DESTDIR)$(packagedir) +- $(INSTALL) etc/baytech.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/baytech-rpc28-nc.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/baytech-rpc3-nc.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/icebox.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/icebox3.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/wti.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/wti-rps10.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/apc.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/apcnew.dev $(DESTDIR)$(packagedir) +-# $(INSTALL) etc/vicebox.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/vpc.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/ibmh8.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/phantom.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/phantom4.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/ipmi.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/cyclades-pm8.dev $(DESTDIR)$(packagedir) +- $(INSTALL) etc/ipmipower.dev $(DESTDIR)$(packagedir) +- $(mkinstalldirs) $(DESTDIR)$(mandir)/man1 +- $(INSTALL) -m 644 man/powerman.1 $(DESTDIR)$(mandir)/man1 +- $(INSTALL) -m 644 man/powermand.1 $(DESTDIR)$(mandir)/man1 +- $(mkinstalldirs) $(DESTDIR)$(mandir)/man5 +- $(INSTALL) -m 644 man/powerman.conf.5 $(DESTDIR)$(mandir)/man5 +- $(mkinstalldirs) $(DESTDIR)$(mandir)/man7 +- $(INSTALL) -m 644 man/powerman-devices.7 $(DESTDIR)$(mandir)/man7 +- $(mkinstalldirs) $(DESTDIR)/etc/rc.d/init.d +- $(INSTALL) -m 755 scripts/powerman.init $(DESTDIR)/etc/rc.d/init.d/powerman ++ $(mkinstalldirs) $(bindir) ++ ${BSD_INSTALL_PROGRAM} src/powerman $(bindir)/ ++ ln -s $(bindir)/powerman $(bindir)/off ++ ln -s $(bindir)/powerman $(bindir)/on ++ ln -s $(bindir)/powerman $(bindir)/pm ++ $(mkinstalldirs) $(sbindir) ++ ${BSD_INSTALL_PROGRAM} src/powermand $(sbindir)/ ++ $(mkinstalldirs) $(packagedir) ++ ${BSD_INSTALL_DATA} etc/baytech.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/baytech-rpc28-nc.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/baytech-rpc3-nc.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/icebox.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/icebox3.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/wti.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/wti-rps10.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/apc.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/apcnew.dev $(packagedir) ++# $(INSTALL) etc/vicebox.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/vpc.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/ibmh8.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/phantom.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/phantom4.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/ipmi.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/cyclades-pm8.dev $(packagedir) ++ ${BSD_INSTALL_DATA} etc/ipmipower.dev $(packagedir) ++ $(mkinstalldirs) $(mandir)/man1 ++ ${BSD_INSTALL_DATA} man/powerman.1 $(mandir)/man1 ++ ${BSD_INSTALL_DATA} man/powermand.1 $(mandir)/man8/powermand.8 ++ $(mkinstalldirs) $(mandir)/man5 ++ ${BSD_INSTALL_DATA} man/powerman.conf.5 $(mandir)/man5 ++ $(mkinstalldirs) $(mandir)/man7 ++ ${BSD_INSTALL_DATA} man/powerman-devices.7 $(mandir)/man7 ++ ${BSD_INSTALL_SCRIPT} scripts/powerman.init $(etcdir)/rc.d/powermand.sh + + clean: + make -C src clean diff --git a/sysutils/powerman/files/patch-man-powerman.1 b/sysutils/powerman/files/patch-man-powerman.1 new file mode 100644 index 000000000000..85533db5534a --- /dev/null +++ b/sysutils/powerman/files/patch-man-powerman.1 @@ -0,0 +1,35 @@ +$FreeBSD$ + +--- man/powerman.1.orig Fri Oct 17 12:42:58 2003 ++++ man/powerman.1 Thu Jun 10 08:38:06 2004 +@@ -152,22 +152,22 @@ + powerman --on "foo[0,4-5]" + .fi + .SH "FILES" +-/usr/sbin/powermand ++%%PREFIX%%/sbin/powermand + .br +-/usr/bin/powerman ++%%PREFIX%%/bin/powerman + .br +-/usr/bin/pm ++%%PREFIX%%/bin/pm + .br +-/usr/bin/on ++%%PREFIX%%/bin/on + .br +-/usr/bin/off ++%%PREFIX%%/bin/off + .br +-/etc/powerman/powerman.conf ++%%PREFIX%%/etc/powerman.conf + .br +-/etc/powerman/*.dev ++%%PREFIX%%/etc/powerman/*.dev + .SH "ORIGIN" + Developed by Andrew Uselton <useton2@llnl.gov> on LLNL's Linux + clusters. This software is open source and distributed under + the terms of the Gnu GPL. + .SH "SEE ALSO" +-powermand(1) powerman.conf(5) ++powermand(8) powerman.conf(5) diff --git a/sysutils/powerman/files/patch-man-powerman.conf.5 b/sysutils/powerman/files/patch-man-powerman.conf.5 new file mode 100644 index 000000000000..5c2cdc7e88a2 --- /dev/null +++ b/sysutils/powerman/files/patch-man-powerman.conf.5 @@ -0,0 +1,21 @@ +$FreeBSD$ + +--- man/powerman.conf.5.orig Wed Aug 6 16:56:56 2003 ++++ man/powerman.conf.5 Thu Jun 10 08:38:10 2004 +@@ -90,13 +90,13 @@ + node "pengra15" "pow1" "8" \fR + .fi + .SH "FILES" +-/etc/powerman/powerman.conf ++%%PREFIX%%/etc/powerman/powerman.conf + .br +-/etc/powerman/*.dev ++%%PREFIX%%/etc/powerman/*.dev + .SH "ORIGIN" + Developed by Andrew Uselton <useton2@llnl.gov> on LLNL's Linux + clusters. This software is open source and distributed under + the terms of the Gnu GPL. + .SH "SEE ALSO" +-powermand(1) powerman(1) ++powermand(8) powerman(1) + diff --git a/sysutils/powerman/files/patch-man-powermand.1 b/sysutils/powerman/files/patch-man-powermand.1 new file mode 100644 index 000000000000..9e814e8d0d33 --- /dev/null +++ b/sysutils/powerman/files/patch-man-powermand.1 @@ -0,0 +1,28 @@ +$FreeBSD$ + +--- man/powermand.1.orig Mon Dec 23 11:26:15 2002 ++++ man/powermand.1 Thu Jun 10 08:38:20 2004 +@@ -25,7 +25,7 @@ + \." 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + \."################################################################# + .\" +-.TH PowerMan 1 "Release 1.0" "LLNL" "PowerMan" ++.TH PowerMan 8 "Release 1.0" "LLNL" "PowerMan" + .SH NAME + powermand \- power control and monitoring daemon + .SH SYNOPSIS +@@ -56,11 +56,11 @@ + .B PowerMan + and exit. + .SH "FILES" +-/usr/sbin/powermand ++%%PREFIX%%/sbin/powermand + .br +-/usr/bin/powerman ++%%PREFIX%%/bin/powerman + .br +-/etc/powerman/powerman.conf ++%%PREFIX%%/etc/powerman/powerman.conf + .SH "ORIGIN" + Developed by Andrew Uselton <useton2@llnl.gov> on LLNL's Linux + clusters. This software is open source and distributed under diff --git a/sysutils/powerman/files/patch-scripts-powerman.init b/sysutils/powerman/files/patch-scripts-powerman.init new file mode 100644 index 000000000000..783106699ec5 --- /dev/null +++ b/sysutils/powerman/files/patch-scripts-powerman.init @@ -0,0 +1,90 @@ +$FreeBSD$ + +--- scripts/powerman.init.orig Thu Jun 10 08:16:04 2004 ++++ scripts/powerman.init Thu Jun 10 08:28:08 2004 +@@ -1,61 +1,27 @@ + #!/bin/sh +-## +-# powerman.init,v 1.3 2001/12/12 20:08:46 dun Exp +-## +-# chkconfig: 345 95 5 +-# description: PowerMan manages Remote Power Controller (RPC) devices +-# processname: /usr/sbin/powermand +-# config: /etc/powerman/powerman.conf +-## ++# $FreeBSD$ + +-# Source function library. +-. /etc/rc.d/init.d/functions ++# PROVIDE: powermand ++# REQUIRE: DAEMON ++# BEFORE: LOGIN ++# KEYWORD: FreeBSD shutdown ++ ++# Define these powermand_* variables in one of these files: ++# /etc/rc.conf ++# /etc/rc.conf.local ++# /etc/rc.conf.d/powermand ++# ++# DO NOT CHANGE THESE DEFAULT VALUES HERE ++# ++powermand_enable=${powermand_enable:-"NO"} ++powermand_flags=${powermand_flags:-""} ++ ++. %%RC_SUBR%% ++ ++name="powermand" ++rcvar=`set_rcvar` ++command="%%PREFIX%%/sbin/powermand" ++required_files="%%PREFIX%%/etc/powerman.conf" + +-# Source networking configuration. +-. /etc/sysconfig/network +- +-# Check that networking is up. +-[ ${NETWORKING} = "no" ] && exit 0 +- +-DAEMON=powermand +-RETVAL=0 +- +-[ -x "/usr/sbin/$DAEMON" ] || exit 0 +- +-# See how we were called. +-case "$1" in +- start) +- echo -n "Starting PowerMan: " +- daemon $DAEMON +- RETVAL=$? +- echo +- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$DAEMON +- ;; +- stop) +- echo -n "Shutting down PowerMan: " +- killproc $DAEMON +- RETVAL=$? +- echo +- [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$DAEMON +- ;; +- status) +- status $DAEMON +- RETVAL=$? +- ;; +- restart) +- $0 stop +- $0 start +- RETVAL=$? +- ;; +- reload) +- echo -n "Reloading PowerMan: " +- killproc $DAEMON -HUP +- RETVAL=$? +- echo +- ;; +- *) +- echo "Usage: $DAEMON {start|stop|status|restart|reload}" +- exit 1 +-esac +- +-exit $RETVAL ++load_rc_config $name ++run_rc_command "$1" diff --git a/sysutils/powerman/files/patch-src-Makefile b/sysutils/powerman/files/patch-src-Makefile new file mode 100644 index 000000000000..645f4060f342 --- /dev/null +++ b/sysutils/powerman/files/patch-src-Makefile @@ -0,0 +1,47 @@ +$FreeBSD$ + +--- src/Makefile.orig Mon Dec 8 20:30:51 2003 ++++ src/Makefile Mon Mar 29 22:04:15 2004 +@@ -3,11 +3,11 @@ + #################################################################### + + PROJECT= powerman +-SHELL= /bin/sh +-CC= gcc +-MAKE= /usr/bin/make +-LEX= /usr/bin/flex +-YACC= /usr/bin/bison ++SHELL?= /bin/sh ++CC?= gcc ++MAKE?= /usr/bin/make ++LEX?= /usr/bin/flex ++YACC?= /usr/bin/bison + + VERSTR= $(shell if test -n "$(VERSION)"; then \ + if test -n "$(RELEASE)"; then \ +@@ -18,10 +18,10 @@ + + DEFS= -DHAVE_CONFIG_H -DPOWERMAN_VERSION=\"$(VERSTR)\" + #DEFS+= -DNDEBUG +-CFLAGS= -g -Wall $(DEFS) ++CFLAGS+= $(DEFS) + #CFLAGS+= -pg + +-LIBS= -lfl -lwrap -lnsl -lutil ++LIBS= -lfl -lwrap -lutil + + COMMON_OBJS = wrappers.o error.o hostlist.o debug.o + +@@ -37,10 +37,10 @@ + all: powerman powermand + + powermand: $(SERVER_OBJS) +- $(CC) $(CFLAGS) -o $@ $(SERVER_OBJS) $(LIBS) ++ $(CC) $(CFLAGS) -o $@ $(SERVER_OBJS) $(LDFLAGS) $(LIBS) + + powerman: $(CLIENT_OBJS) +- $(CC) -o $@ $(CLIENT_OBJS) $(LIBS) ++ $(CC) -o $@ $(CLIENT_OBJS) $(LDFLAGS) $(LIBS) + + parse_lex.c: parse.lex + $(LEX) -oparse_lex.c parse.lex diff --git a/sysutils/powerman/files/patch-src-client.c b/sysutils/powerman/files/patch-src-client.c new file mode 100644 index 000000000000..3a0eb9e99dad --- /dev/null +++ b/sysutils/powerman/files/patch-src-client.c @@ -0,0 +1,19 @@ +$FreeBSD$ + +--- src/client.c.orig Mon Mar 29 14:25:54 2004 ++++ src/client.c Mon Mar 29 14:27:27 2004 +@@ -31,10 +31,14 @@ + #include <syslog.h> + #include <stdarg.h> + ++#include <sys/types.h> ++#include <netinet/in.h> + #include <arpa/inet.h> + #include <tcpd.h> + #include <stdio.h> + #include <fcntl.h> ++#include <sys/socket.h> ++#include <limits.h> + + #include "powerman.h" + #include "wrappers.h" diff --git a/sysutils/powerman/files/patch-src-device_pipe.c b/sysutils/powerman/files/patch-src-device_pipe.c new file mode 100644 index 000000000000..0628e58e6d4c --- /dev/null +++ b/sysutils/powerman/files/patch-src-device_pipe.c @@ -0,0 +1,15 @@ +$FreeBSD$ + +--- src/device_pipe.c.orig Mon Mar 29 22:02:27 2004 ++++ src/device_pipe.c Mon Mar 29 22:02:48 2004 +@@ -38,7 +38,10 @@ + #include <ctype.h> + #include <sys/types.h> + #include <sys/wait.h> ++#include <signal.h> ++#ifdef __linux__ + #include <pty.h> ++#endif + + + #include "powerman.h" diff --git a/sysutils/powerman/files/patch-src-hostlist.c b/sysutils/powerman/files/patch-src-hostlist.c new file mode 100644 index 000000000000..74d928504e98 --- /dev/null +++ b/sysutils/powerman/files/patch-src-hostlist.c @@ -0,0 +1,13 @@ +$FreeBSD$ + +--- src/hostlist.c.orig Mon Mar 29 13:50:02 2004 ++++ src/hostlist.c Mon Mar 29 13:50:18 2004 +@@ -43,7 +43,7 @@ + #include <assert.h> + #include <errno.h> + #include <ctype.h> +-#include <sys/param.h> ++#include <limits.h> + #include <unistd.h> + + #include "hostlist.h" diff --git a/sysutils/powerman/files/patch-src-parse.lex b/sysutils/powerman/files/patch-src-parse.lex new file mode 100644 index 000000000000..ae7e6964272e --- /dev/null +++ b/sysutils/powerman/files/patch-src-parse.lex @@ -0,0 +1,12 @@ +$FreeBSD$ + +--- src/parse.lex.orig Mon Mar 29 21:57:12 2004 ++++ src/parse.lex Mon Mar 29 21:57:46 2004 +@@ -41,6 +41,7 @@ + #include "error.h" + #include "parse_util.h" + extern void yyerror(); ++extern YYSTYPE yylval; + + #define MAX_INCLUDE_DEPTH 10 + static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; diff --git a/sysutils/powerman/files/patch-src-parse.y b/sysutils/powerman/files/patch-src-parse.y new file mode 100644 index 000000000000..d4acacea8611 --- /dev/null +++ b/sysutils/powerman/files/patch-src-parse.y @@ -0,0 +1,23 @@ +$FreeBSD$ + +--- src/parse.y.orig Thu Jun 17 09:57:08 2004 ++++ src/parse.y Thu Jun 17 09:58:28 2004 +@@ -37,6 +37,7 @@ + #include <stdio.h> + #include <ctype.h> + #include <unistd.h> ++#include <limits.h> + + #include "powerman.h" + #include "list.h" +@@ -48,6 +49,10 @@ + #include "device_tcp.h" + #include "error.h" + #include "string.h" ++ ++#ifdef __FreeBSD__ ++typedef int reg_syntax_t; ++#endif + + /* + * A PreScript is a list of PreStmts. diff --git a/sysutils/powerman/files/patch-src-powerman.c b/sysutils/powerman/files/patch-src-powerman.c new file mode 100644 index 000000000000..d878789ed216 --- /dev/null +++ b/sysutils/powerman/files/patch-src-powerman.c @@ -0,0 +1,38 @@ +$FreeBSD$ + +--- src/powerman.c.orig Sun Nov 30 16:13:28 2003 ++++ src/powerman.c Thu Jun 17 09:11:40 2004 +@@ -34,6 +34,8 @@ + #include <stdlib.h> + #include <assert.h> + #include <libgen.h> ++#include <limits.h> ++#include <sys/socket.h> + + #include "powerman.h" + #include "wrappers.h" +@@ -78,6 +80,24 @@ + }; + + static const struct option *longopts = long_options; ++ ++#ifdef __FreeBSD__ ++#include <stdarg.h> ++ ++#define BUF_MAX 1024 ++ ++static int dprintf(int fd, char *const fmt, ...) ++{ ++ int ret; ++ va_list ap; ++ char buf[BUF_MAX]; ++ ++ va_start(ap, fmt); ++ ret = vsnprintf(buf, BUF_MAX, fmt, ap); ++ va_end(ap); ++ return (int) write(fd, buf, (ret > BUF_MAX) ? BUF_MAX : ret); ++} ++#endif + + int main(int argc, char **argv) + { diff --git a/sysutils/powerman/files/patch-src-powerman.h b/sysutils/powerman/files/patch-src-powerman.h new file mode 100644 index 000000000000..953679fd596d --- /dev/null +++ b/sysutils/powerman/files/patch-src-powerman.h @@ -0,0 +1,19 @@ +$FreeBSD$ + +--- src/powerman.h.orig Thu Jun 10 08:57:15 2004 ++++ src/powerman.h Thu Jun 10 08:57:55 2004 +@@ -39,10 +39,10 @@ + #endif /* MIN */ + + #define DAEMON_NAME "powermand" +-#define PID_FILE_NAME "/var/run/powerman/powerman.pid" +-#define PID_DIR "/var/run/powerman" +-#define ROOT_DIR "/etc/powerman" +-#define DFLT_CONFIG_FILE "/etc/powerman/powerman.conf" ++#define PID_FILE_NAME "/var/run/powerman.pid" ++#define PID_DIR "/var/run" ++#define ROOT_DIR "%%PREFIX%%/etc/powerman" ++#define DFLT_CONFIG_FILE "%%PREFIX%%/etc/powerman.conf" + + #define DFLT_PORT "10101" + #define DFLT_HOSTNAME "localhost" diff --git a/sysutils/powerman/files/patch-src-powermand.c b/sysutils/powerman/files/patch-src-powermand.c new file mode 100644 index 000000000000..c893d8b10c90 --- /dev/null +++ b/sysutils/powerman/files/patch-src-powermand.c @@ -0,0 +1,15 @@ +$FreeBSD$ + +--- src/powermand.c.orig Mon Mar 29 14:23:55 2004 ++++ src/powermand.c Mon Mar 29 14:24:44 2004 +@@ -35,6 +35,10 @@ + #include <stdlib.h> + #include <stdio.h> + #include <assert.h> ++#ifdef __linux__ ++#include <list.h> ++#endif ++#include <limits.h> + + #include "powerman.h" + #include "list.h" diff --git a/sysutils/powerman/files/patch-src-wrappers.c b/sysutils/powerman/files/patch-src-wrappers.c new file mode 100644 index 000000000000..e5e9cc6a404f --- /dev/null +++ b/sysutils/powerman/files/patch-src-wrappers.c @@ -0,0 +1,35 @@ +$FreeBSD$ + +--- src/wrappers.c.orig Mon Mar 29 12:59:20 2004 ++++ src/wrappers.c Mon Mar 29 13:47:54 2004 +@@ -42,6 +42,7 @@ + #if HAVE_POLL + #include <sys/poll.h> + #endif ++#include <limits.h> + + #include "wrappers.h" + #include "cbuf.h" +@@ -486,7 +487,10 @@ + */ + if (!((errno == EWOULDBLOCK) || + (errno == ECONNABORTED) || +- (errno == EPROTO) || (errno == EINTR))) ++#ifdef __linux__ ++ (errno == EPROTO) || ++#endif ++ (errno == EINTR))) + lsd_fatal_error(__FILE__, __LINE__, "accept"); + } + return new; +@@ -639,8 +643,10 @@ + int n; + char buf[MAX_REG_BUF]; + ++#ifdef __linux__ + /* Review: undocumented, is it needed? */ + re_syntax_options = RE_SYNTAX_POSIX_EXTENDED; ++#endif + Strncpy(buf, string, MAX_REG_BUF); + n = regexec(preg, buf, nmatch, pmatch, eflags); + return n; diff --git a/sysutils/powerman/files/patch-src-wrappers.h b/sysutils/powerman/files/patch-src-wrappers.h new file mode 100644 index 000000000000..04edc0cdda8e --- /dev/null +++ b/sysutils/powerman/files/patch-src-wrappers.h @@ -0,0 +1,19 @@ +$FreeBSD$ + +--- src/wrappers.h.orig Mon Mar 29 12:57:11 2004 ++++ src/wrappers.h Mon Mar 29 13:46:45 2004 +@@ -35,9 +35,14 @@ + #include <sys/time.h> + #include <time.h> + #include <regex.h> ++#include <netinet/in.h> + #include <netdb.h> + #if HAVE_POLL + #include <sys/poll.h> ++#endif ++ ++#ifdef __FreeBSD__ ++#define REG_NOERROR 0 + #endif + + /* diff --git a/sysutils/powerman/files/patch-test-Makefile b/sysutils/powerman/files/patch-test-Makefile new file mode 100644 index 000000000000..96d09cfb4fe2 --- /dev/null +++ b/sysutils/powerman/files/patch-test-Makefile @@ -0,0 +1,20 @@ +$FreeBSD$ + +--- test/Makefile.orig Mon Dec 8 20:30:52 2003 ++++ test/Makefile Tue Mar 30 10:19:02 2004 +@@ -1,10 +1,13 @@ +-CFLAGS= -g -Wall -I../src ++#CFLAGS= -g -Wall -I../src ++CFLAGS+= -Wall -I../src + VICEOBJS = vicebox.o wrappers.o error.o debug.o + + all: vpcd + + vpcd: vpcd.o +- $(CC) -o $@ $< -lpthread ++ $(CC) -o $@ $< ${LDFLAGS} ${PTHREAD_LIBS} ++vpcd.o: vpcd.c ++ $(CC) $(CPPFLAGS) $(CFLAGS) ${PTHREAD_CFLAGS} -c -o $@ $< + + vicebox : $(VICEOBJS) + $(CC) $(CFLAGS) -o $@ $(VICEOBJS) diff --git a/sysutils/powerman/files/patch-test-vpcd.c b/sysutils/powerman/files/patch-test-vpcd.c new file mode 100644 index 000000000000..53ffe18f4800 --- /dev/null +++ b/sysutils/powerman/files/patch-test-vpcd.c @@ -0,0 +1,47 @@ +$FreeBSD$ + +--- test/vpcd.c.orig Mon Dec 1 01:16:33 2003 ++++ test/vpcd.c Thu Jun 17 09:38:30 2004 +@@ -16,6 +16,8 @@ + #include <getopt.h> + #include <unistd.h> + #include <stdlib.h> ++#include <sys/types.h> ++#include <netinet/in.h> + #include <arpa/inet.h> + #include <sys/types.h> + #include <sys/socket.h> +@@ -49,6 +51,24 @@ + + static int errcount = 0; + ++#ifdef __FreeBSD__ ++#include <stdarg.h> ++ ++#define BUF_MAX 1024 ++ ++static int dprintf(int fd, char *const fmt, ...) ++{ ++ int ret; ++ va_list ap; ++ char buf[BUF_MAX]; ++ ++ va_start(ap, fmt); ++ ret = vsnprintf(buf, BUF_MAX, fmt, ap); ++ va_end(ap); ++ return (int) write(fd, buf, (ret > BUF_MAX) ? BUF_MAX : ret); ++} ++#endif ++ + static void _noop_handler(int signum) + { + fprintf(stderr, "vpcd: received signal %d\n", signum); +@@ -392,7 +412,7 @@ + case 'n': /* --num_threads n */ + num_threads = strtol(optarg, NULL, 0); + if (num_threads < MIN_THREADS || num_threads > MAX_THREADS) { +- fprintf(stderr, "num_threads value out of range (%d-%d)\n", ++ fprintf(stderr, "num_threads value out of range (%d-%ld)\n", + MIN_THREADS, MAX_THREADS); + exit(1); + } diff --git a/sysutils/powerman/pkg-descr b/sysutils/powerman/pkg-descr new file mode 100644 index 000000000000..fbe1ad93bb78 --- /dev/null +++ b/sysutils/powerman/pkg-descr @@ -0,0 +1,6 @@ +PowerMan is a tool for manipulating remote power control (RPC) +devices from a central location. Several RPC varieties are supported +natively by PowerMan and Expect-like configurability simplifies the +addition of new devices. + +WWW: http://www.llnl.gov/linux/powerman/ diff --git a/sysutils/powerman/pkg-plist b/sysutils/powerman/pkg-plist new file mode 100644 index 000000000000..b82f30f65f7a --- /dev/null +++ b/sysutils/powerman/pkg-plist @@ -0,0 +1,23 @@ +bin/powerman +bin/off +bin/on +bin/pm +etc/powerman/apc.dev +etc/powerman/apcnew.dev +etc/powerman/baytech-rpc28-nc.dev +etc/powerman/baytech-rpc3-nc.dev +etc/powerman/baytech.dev +etc/powerman/cyclades-pm8.dev +etc/powerman/ibmh8.dev +etc/powerman/icebox.dev +etc/powerman/icebox3.dev +etc/powerman/ipmi.dev +etc/powerman/ipmipower.dev +etc/powerman/phantom.dev +etc/powerman/phantom4.dev +etc/powerman/vpc.dev +etc/powerman/wti-rps10.dev +etc/powerman/wti.dev +etc/rc.d/powermand.sh +sbin/powermand +@dirrm etc/powerman |