Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 7006 - New NUT-ebuild
Summary: New NUT-ebuild
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Donny Davies (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-25 07:17 UTC by fbusse
Modified: 2003-02-04 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fbusse 2002-08-25 07:17:54 UTC
Updated the nut-ebuild to work with the new 1.0.0-version that fixes some small
bugs and a chrash in upsd.
http://www.exploits.org/nut/release/new-1.0.0.txt
Still has the problem with cgi-dependency (uses USE=PNG for cgi-compilation).


S=${WORKDIR}/${P}
DESCRIPTION="Network-UPS Tools"
SRC_URI="http://www.exploits.org/nut/release/${P}.tar.gz"
HOMEPAGE="http://www.exploits.org/nut/"
KEYWORDS="x86 sparc sparc64"
LICENSE="GPL-2"
SLOT="0"

# -- [ FIXME ] --
# a better idea would be to have virtual/httpd dependencies and
# USE cgi-bin support.  USE png is used for now :/

DEPEND="virtual/glibc
        png? ( =sys-libs/zlib-1* =media-libs/libgd-1* =media-libs/libpng-1.2* )"
RDEPEND="${DEPEND} png? ( =net-www/apache-1* )"

src_compile() {
        local myconf
        use png && myconf="--with-cgi --with-cgipath=/home/httpd/cgi-bin"
        use png || myconf="--without-cgi"

        #default is to build all drivers; but the following is common:
        #--with-drivers=apcsmart,hidups
        ./configure \
                --prefix=/usr \
                --with-user=nut \
                --with-group=nut \
                --sysconfdir=/etc/nut \
                --mandir=/usr/share/man \
                --with-pidpath=/var/run \
                --with-logfacility=LOG_DAEMON \
                --with-statepath=/var/state/nut \
                --with-altpidpath=/var/state/nut \
                --host=${CHOST} ${myconf} || die

        emake || die

        if [ -n "`use png`" ]
        then
                emake cgi || die
        fi
}

src_install() {
        # Makefile: user/group nut might not exist until after
        # pkg_preinst() runs; so use root for now, and fix it
        # up in pkg_postinst().
        make DESTDIR=${D} RUNUID=root RUNGID=root install || die

        if [ -n "`use png`" ]
        then
                make DESTDIR=${D} install-cgi || die
        fi
        # see above note...
        rm -rf ${D}/var/state/nut

        dodoc CHANGES COPYING CREDITS INSTALL NEWS \
                README docs/{FAQ,*.txt}
        docinto cables ; dodoc docs/cables/*.txt
        docinto drivers ; dodoc docs/drivers/*.txt

        # clean up /etc/nut/*.sample files
        cd ${D}/etc/nut
        for i in *.sample
        do
                mv $i ${i/.sample/}
        done

        exeinto /etc/init.d
        newexe ${FILESDIR}/upsd-init upsd
        newexe ${FILESDIR}/upsmon-init upsmon
}

pkg_preinst() {
        if ! groupmod nut ; then
                groupadd -g 84 nut || die "problem adding group nut"
        fi

        # usermod returns 2 on user-exists-but-no-flags-given
        usermod nut &>/dev/null
        if [ $? != 2 ] ; then
                useradd -u 84 -g nut -s /bin/false -c "nut" \
                        -d /var/state/nut nut || die "problem adding user nut"
        fi
}

pkg_postinst() {
        install -m0700 -o nut -g nut -d ${ROOT}/var/state/nut
}
Comment 1 Donny Davies (RETIRED) gentoo-dev 2002-08-26 23:30:38 UTC
actually i already released a nut-1.0.0 ebuild before receiving this bug
but please dont attach ebuild files like that in the future.

what did you change?  its not at all apparent, and impossible to readily
assume from a flood on bugzilla.

anyway, try the new 1.0.0 release, i dont think i had to change much if
anything at all.

        Woodchip

Comment 2 fbusse 2002-08-27 01:34:44 UTC
Is "--with-drvpath=/sbin" really a good idea? Why not using /usr/sbin, so just use "--prefix=/usr"? 
Comment 3 Donny Davies (RETIRED) gentoo-dev 2002-08-27 01:40:37 UTC
please dont make horrible sugestions like that unless yuo know what you're asking.

that is a really bad idea.

the drivers go into /sbin for a reason, if you dont understand why, then read
the FAQ or something.