1 # Copyright 1999-2002 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License, v2 or later
3 # $Header: /cvsroot/apcupsd/apcupsd/platforms/gentoo/ebuild,v 1.3 2004/04/01 20:32:22 wrking Exp $
6 DESCRIPTION="APC UPS daemon with integrated tcp/ip remote shutdown (*ALPHA*)"
7 SRC_URI="http://www.sibbald.com/apcupsd/development/${P}.tar.gz \
8 http://www.sibbald.com/apcupsd/contrib/gd1.2.tar.gz"
9 HOMEPAGE="http://www.sibbald.com/apcupsd/"
21 XSYSCONFDIR=/etc/apcupsd
22 XPWRFAILDIR=${XSYSCONFDIR}
27 cp -a ${WORKDIR}/gd1.2 ${S}/src/
29 ln -s /usr/portage/sys-apps/apcupsd/files ${WORKDIR}/files
32 patch -p1 < ${FILESDIR}/${P}-gentoo.patch
36 # patch touches configure.in, so we must regenerate configure
37 WANT_AUTOCONF_2_5=1 autoconf/autoregen.sh
38 APCUPSD_MAIL=/usr/sbin/ssmtp ./configure \
41 --sysconfdir=${XSYSCONFDIR} \
42 --with-pwrfail-dir=${XPWRFAILDIR} \
43 --with-lock-dir=${XLOCKDIR} \
44 --with-pid-dir=${XPIDDIR} \
45 --with-log-dir=${XLOGDIR} \
46 --with-distname=gentoo \
49 --with-serial-dev=/dev/usb/hid/hiddev[0-9] \
50 --with-net-port=6666 \
51 --with-nis-port=7000 \
56 --with-cgi-bin=/home/httpd/apcupsd \
64 make DESTDIR=${GEN2DD%*/} install
66 # fixup smtp scripts for ssmtp compatibility
67 echo "Editing mail scripts for ssmtp compatibility..."
69 patch -p1 < ${FILESDIR}/${P}-ssmtp.patch
71 echo "Installing full documentation into /usr/share/doc/${P}..."
74 docinto developers_manual
75 dodoc developers_manual/*
88 echo "Stopping old apcupsd daemon..."
89 /etc/init.d/apcupsd stop
92 XAPCPID=${XPIDDIR}/apcupsd.pid
95 if test -f $XAPCPID -a -d /proc/`cat $XAPCPID`; then
97 touch /etc/apcupsd/.wasrunning
98 elif ! test -f /etc/apcupsd/apcupsd.conf; then
100 touch /etc/apcupsd/.newinstall
105 if test -f /etc/apcupsd/.wasrunning; then
106 echo "Restarting new apcupsd daemon..."
107 /etc/init.d/apcupsd start
108 rm -f /etc/apcupsd/.wasrunning
109 elif test -f /etc/apcupsd/.newinstall; then
110 echo "Adding to standard runlevels..."
111 rc-update add apcupsd boot default nonetwork single
112 rm -f /etc/apcupsd/.newinstall
113 echo "Edit ${SYSCONFDIR}/apcupsd.conf for your UPS."
118 if test -f $XAPCPID -a -d /proc/`cat $XAPCPID`; then
124 # if all packages instances are unmerged, daemon will go missing
125 if ! test -x /usr/sbin/apcupsd -o -x /sbin/apcupsd; then
126 # so then clean up the config files to avoid a messy /etc
127 echo "Removing apcupsd from all runlevels..."
128 rc-update del apcupsd
129 echo "Removing apcupsd configuration files..."
131 rm -f /etc/init.d/apcupsd
132 rm -f /etc/init.d/halt # we installed it, but still...