diff options
author | nork <nork@FreeBSD.org> | 2006-02-04 23:13:37 +0800 |
---|---|---|
committer | nork <nork@FreeBSD.org> | 2006-02-04 23:13:37 +0800 |
commit | b62472440b1574e34cdfecb9e8115278f55b77ff (patch) | |
tree | a00a13b5e7a3df913059921902cf7188f8f6a4a7 /sysutils/freqsdwn | |
parent | 837acedf6201281879d0f4144f402c7351628038 (diff) | |
download | freebsd-ports-gnome-b62472440b1574e34cdfecb9e8115278f55b77ff.tar.gz freebsd-ports-gnome-b62472440b1574e34cdfecb9e8115278f55b77ff.tar.zst freebsd-ports-gnome-b62472440b1574e34cdfecb9e8115278f55b77ff.zip |
Add FREQSHIP-mini Mitsubishi Electric UPS
controller daemon, is supported following
UPS series:
FREQUPS FW-F series
FREQUPS FW-A series
FREQUPS FW-V series
PowerUPS AX-M series
Sponsored by: Ensure Technology Ltd
Reviewed by: ume
Diffstat (limited to 'sysutils/freqsdwn')
-rw-r--r-- | sysutils/freqsdwn/Makefile | 61 | ||||
-rw-r--r-- | sysutils/freqsdwn/distinfo | 3 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/000.freqshpk.sh.in | 30 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/Makefile.daemon | 13 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/Makefile.subdir | 5 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/Makefile.upsdown | 13 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/UPSFILE | 10 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/freqshpd.sh.in | 34 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/patch-common-freqship.h | 20 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/patch-daemon-freqmain.c | 19 | ||||
-rw-r--r-- | sysutils/freqsdwn/files/patch-upsdown-upsdown.c | 31 | ||||
-rw-r--r-- | sysutils/freqsdwn/pkg-descr | 14 | ||||
-rw-r--r-- | sysutils/freqsdwn/pkg-message | 29 | ||||
-rw-r--r-- | sysutils/freqsdwn/pkg-plist | 9 |
14 files changed, 291 insertions, 0 deletions
diff --git a/sysutils/freqsdwn/Makefile b/sysutils/freqsdwn/Makefile new file mode 100644 index 000000000000..369c05b8d254 --- /dev/null +++ b/sysutils/freqsdwn/Makefile @@ -0,0 +1,61 @@ +# New ports collection makefile for: freqsdwn +# Date created: 2005/11/20 +# Whom: n-shigemura@ensure.jp +# +# $FreeBSD$ +# + +PORTNAME= freqsdwn +PORTVERSION= 2.00 +CATEGORIES= sysutils japanese +MASTER_SITES= http://www.mitsubishielectric.co.jp/frequps/down/ +DISTNAME= ${PORTNAME:C/freq//}_${PORTVERSION} +EXTRACT_SUFX= .tgz +DIST_SUBDIR= freqship + +MAINTAINER= nork@FreeBSD.org +COMMENT= FREQSHIP-mini Mitsubishi Electric UPS controller daemon + +RESTRICTED= See http://www.mitsubishielectric.co.jp/frequps/keiyaku.html +NO_CDROM= ${RESTRICTED} +NO_PACKAGE= ${RESTRICTED} + +USE_RC_SUBR= freqshpd.sh 000.freqshpk.sh +PLIST_SUB= PORTNAME=${PORTNAME} CONFDIR=${CONFDIR} +SUB_LIST= PORTNAME=${PORTNAME} CONFDIR=${CONFDIR} + +WRKSRC= ${WRKDIR}/freqship +PORTDOCS= README + +CONFDIR?= ${PREFIX}/etc/freqship + +pre-fetch:: + @[ -f ${DISTDIR}/${DIST_SUBDIR}/${DISTNAME}${EXTRACT_SUFX} ] || ( \ + ${ECHO} "Please read and accept following LICENSE:"; \ + ${ECHO} "http://www.mitsubishielectric.co.jp/frequps/keiyaku.html"; \ + ${ECHO} "Please 'make do-fetch' manually, if you accept it."; \ + ${FALSE}) + +post-extract: + @${CP} ${WRKSRC}/common/freqship.org ${WRKSRC}/common/freqship.h + @${CP} ${FILESDIR}/UPSFILE ${WRKSRC}/initdata/ +.for dir in subdir daemon upsdown + @${CP} ${FILESDIR}/Makefile.${dir} ${WRKSRC}/${dir:subdir=}/Makefile +.endfor + +post-install: + @${MKDIR} ${CONFDIR} +.for FILE in UPSFILE UPSSTAT PMSGERR PMSGOK DELAY + @${INSTALL_DATA} ${WRKSRC}/initdata/${FILE} ${PREFIX}/etc/freqship/${FILE}-dist + @[ -f ${PREFIX}/etc/freqship/${FILE} ] || \ + ${CP} ${WRKSRC}/initdata/${FILE} ${PREFIX}/etc/freqship/${FILE} +.endfor +.if !defined(NOPORTDOCS) + @${MKDIR} ${DOCSDIR} +.for FILE in ${PORTDOCS} + @${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR} +.endfor +.endif + @${CAT} ${PKGMESSAGE} + +.include <bsd.port.mk> diff --git a/sysutils/freqsdwn/distinfo b/sysutils/freqsdwn/distinfo new file mode 100644 index 000000000000..4783cb768df9 --- /dev/null +++ b/sysutils/freqsdwn/distinfo @@ -0,0 +1,3 @@ +MD5 (freqship/sdwn_2.00.tgz) = 5c6f4a88864bc42b634da15adbee4adc +SHA256 (freqship/sdwn_2.00.tgz) = 31fd9ccc6ca7cefe3bd7cfc43622fa1002edc5062b81eb6d82f89d70b6f05262 +SIZE (freqship/sdwn_2.00.tgz) = 14365 diff --git a/sysutils/freqsdwn/files/000.freqshpk.sh.in b/sysutils/freqsdwn/files/000.freqshpk.sh.in new file mode 100644 index 000000000000..9aacecee1ee1 --- /dev/null +++ b/sysutils/freqsdwn/files/000.freqshpk.sh.in @@ -0,0 +1,30 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: freqshpk +# REQUIRE: DAEMON +# KEYWORD: nostart shutdown +# +# Define these freqshpk_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/freqshpk +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +freqshpk_enable=${freqshpk_enable-"NO"} + +. %%RC_SUBR%% + +name=freqshpk +rcvar=`set_rcvar` +command=%%PREFIX%%/sbin/freqshpk + +load_rc_config ${name} + +start_cmd=: +required_files=%%PREFIX%%/etc/freqship/UPSFILE +stop_cmd=${command} + +run_rc_command "$1" diff --git a/sysutils/freqsdwn/files/Makefile.daemon b/sysutils/freqsdwn/files/Makefile.daemon new file mode 100644 index 000000000000..b9ef7f1e0007 --- /dev/null +++ b/sysutils/freqsdwn/files/Makefile.daemon @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= freqshpd +SRCS= freqmain.c +NOMAN= yes +NO_MAN= yes + +BINDIR= ${PREFIX}/sbin +BINMODE= 0510 + +CFLAGS+= -DPREFIX='"${PREFIX}"' + +.include <bsd.prog.mk> diff --git a/sysutils/freqsdwn/files/Makefile.subdir b/sysutils/freqsdwn/files/Makefile.subdir new file mode 100644 index 000000000000..f4c5790cf6f2 --- /dev/null +++ b/sysutils/freqsdwn/files/Makefile.subdir @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= daemon upsdown + +.include <bsd.subdir.mk> diff --git a/sysutils/freqsdwn/files/Makefile.upsdown b/sysutils/freqsdwn/files/Makefile.upsdown new file mode 100644 index 000000000000..c1d60cc2be4e --- /dev/null +++ b/sysutils/freqsdwn/files/Makefile.upsdown @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= freqshpk +SRCS= upsdown.c +NOMAN= yes +NO_MAN= yes + +BINDIR= ${PREFIX}/sbin +BINMODE= 0510 + +CFLAGS+= -DPREFIX='"${PREFIX}"' + +.include <bsd.prog.mk> diff --git a/sysutils/freqsdwn/files/UPSFILE b/sysutils/freqsdwn/files/UPSFILE new file mode 100644 index 000000000000..6b853c7860c9 --- /dev/null +++ b/sysutils/freqsdwn/files/UPSFILE @@ -0,0 +1,10 @@ +Port=/dev/ttyd0 +Delay=60 +Mailsend=0 +Mailto=root +Upsbatt=0 +Upslow=0 +Upsrmt=1 +Refresh=5 +Slave=0 +MstrAdr= diff --git a/sysutils/freqsdwn/files/freqshpd.sh.in b/sysutils/freqsdwn/files/freqshpd.sh.in new file mode 100644 index 000000000000..168d094a475e --- /dev/null +++ b/sysutils/freqsdwn/files/freqshpd.sh.in @@ -0,0 +1,34 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: freqshpd +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Define these freqshpd_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# /etc/rc.conf.d/freqshpd +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +# +freqshpd_enable=${freqshpd_enable-"NO"} + +. %%RC_SUBR%% + +name=freqshpd +rcvar=`set_rcvar` +command=%%PREFIX%%/sbin/freqshpd + +load_rc_config ${name} + +pidfile=/var/run/freqshpd.pid +required_files=%%PREFIX%%/etc/freqship/UPSFILE +stop_postcmd="freqsdwn_poststop" + +freqsdwn_poststop() { + /bin/rm -f ${pidfile} +} + +run_rc_command "$1" diff --git a/sysutils/freqsdwn/files/patch-common-freqship.h b/sysutils/freqsdwn/files/patch-common-freqship.h new file mode 100644 index 000000000000..4bf21f09117c --- /dev/null +++ b/sysutils/freqsdwn/files/patch-common-freqship.h @@ -0,0 +1,20 @@ ++++ common/freqship.org Wed Aug 9 19:16:00 2000 +--- common/freqship.h Sun Nov 20 13:38:11 2005 +@@ -1,10 +1,10 @@ +-#define UPSFILE "/etc/freqship/UPSFILE" +-#define STATFILE "/etc/freqship/STATUS" +-#define PMSGEFILE "/etc/freqship/PMSGERR" +-#define PMSGOFILE "/etc/freqship/PMSGOK" +-#define DELAYFILE "/etc/freqship/DELAY" +-#define UPSSTAT "/etc/freqship/UPSSTAT" +-#define DAEMON "/sbin/freqshpd" ++#define UPSFILE PREFIX "/etc/freqship/UPSFILE" ++#define STATFILE PREFIX "/etc/freqship/STATUS" ++#define PMSGEFILE PREFIX "/etc/freqship/PMSGERR" ++#define PMSGOFILE PREFIX "/etc/freqship/PMSGOK" ++#define DELAYFILE PREFIX "/etc/freqship/DELAY" ++#define UPSSTAT PREFIX "/etc/freqship/UPSSTAT" ++#define DAEMON PREFIX "/sbin/freqshpd" + + /* UPS States '99-10-15 BCC */ + #define S_NOCHANGE -1 /* don't know */ diff --git a/sysutils/freqsdwn/files/patch-daemon-freqmain.c b/sysutils/freqsdwn/files/patch-daemon-freqmain.c new file mode 100644 index 000000000000..8ad95141b0cf --- /dev/null +++ b/sysutils/freqsdwn/files/patch-daemon-freqmain.c @@ -0,0 +1,19 @@ +--- daemon/freqmain.c.orig Thu Jun 30 09:20:10 2005 ++++ daemon/freqmain.c Sun Feb 5 00:06:50 2006 +@@ -553,12 +553,12 @@ + unlink(idf); + + /* シャットダウン準備 */ +- system("/bin/sync"); +- system("/bin/sync"); +- system("/bin/sync"); ++ sync(); ++ sync(); ++ sync(); + + /* シャットダウン開始 */ +- system("shutdown -h now"); ++ system("/sbin/shutdown -h now"); + + exit(0); + } diff --git a/sysutils/freqsdwn/files/patch-upsdown-upsdown.c b/sysutils/freqsdwn/files/patch-upsdown-upsdown.c new file mode 100644 index 000000000000..85cda069de56 --- /dev/null +++ b/sysutils/freqsdwn/files/patch-upsdown-upsdown.c @@ -0,0 +1,31 @@ +--- upsdown/upsdown.c.orig Wed May 18 10:14:00 2005 ++++ upsdown/upsdown.c Wed Jan 25 13:47:45 2006 +@@ -154,22 +154,28 @@ + /* COMポートのクローズ */ + close (pd); + ++#if 0 + sprintf(command, "halt %s", arg_buf_wo_p); + system(command); + sleep (10); ++#endif + } + else if (pow == '1') + { /* input power restored */ + /* COMポートのクローズ */ + close (pd); ++#if 0 + system ("reboot -i -d -p"); ++#endif + } + else + { /* manual shutdown */ + /* COMポートのクローズ */ + close (pd); ++#if 0 + sprintf(command, "halt %s", arg_buf); + system(command); ++#endif + } + + exit (0); diff --git a/sysutils/freqsdwn/pkg-descr b/sysutils/freqsdwn/pkg-descr new file mode 100644 index 000000000000..b45791198f39 --- /dev/null +++ b/sysutils/freqsdwn/pkg-descr @@ -0,0 +1,14 @@ +FREQSHIP-mini can be used for controlling Mitsubishi Electric UPSs. + + freqsdwn supports following UPS seriese. + + FREQUPS FW-F series + FREQUPS FW-A series + FREQUPS FW-V series + PowerUPS AX-M series + + It can monitor the current power and battery status, + perform automatic shutdown, and machine OFF->ON + on power recovery. + +WWW: http://www.mitsubishielectric.co.jp/frequps/ diff --git a/sysutils/freqsdwn/pkg-message b/sysutils/freqsdwn/pkg-message new file mode 100644 index 000000000000..58d21f868028 --- /dev/null +++ b/sysutils/freqsdwn/pkg-message @@ -0,0 +1,29 @@ +=============================================================================== + + * IMPORTANT SETUP NOTICE * IMPORTANT SETUP NOTICE * + +o Set UPS's DIP SWITCH like following: + FREQUPS FW-F series + 1: ON (must) + 2: ON (require) + 3: OFF (not use) + 4: ON (must) + 5: OFF (not use) + 6: ON (recommended) + +o Set your /etc/rc.conf like following: + + ------------------------------------- + freqshpd_enable="YES" + freqshpk_enable="YES" + rcshutdown_timeout="60" # if you use squid or etc.. + ------------------------------------- + +o Add following lines to /etc/syslog.conf + + ------------------------------------- + !freqshpd + daemon.* /var/log/freqshpd.log + ------------------------------------- + +=============================================================================== diff --git a/sysutils/freqsdwn/pkg-plist b/sysutils/freqsdwn/pkg-plist new file mode 100644 index 000000000000..a6ed79ae4230 --- /dev/null +++ b/sysutils/freqsdwn/pkg-plist @@ -0,0 +1,9 @@ +sbin/freqshpd +sbin/freqshpk +@unexec if cmp -s %D/etc/freqship/UPSFILE %D/etc/freqship/UPSFILE-dist; then rm -f %D/etc/freqship/UPSFILE; fi +etc/freqship/UPSFILE-dist +@exec [ -f %B/UPSFILE ] || cp -p %B/%f %B/UPSFILE +@unexec if cmp -s %D/etc/freqship/UPSSTAT %D/etc/freqship/UPSSTAT-dist; then rm -f %D/etc/freqship/UPSSTAT; fi +etc/freqship/UPSSTAT-dist +@exec [ -f %B/UPSSTAT ] || cp -p %B/%f %B/UPSSTAT +@dirrmtry etc/freqship |