diff options
author | Florian Bruhin | 2014-02-20 11:50:30 +0100 |
---|---|---|
committer | Florian Bruhin | 2014-02-20 11:50:30 +0100 |
commit | 6233e3b3af8f0c15fee71b0b4995db13bbfc55ba (patch) | |
tree | dc419207dc44618398f74654949c5da985c6c920 | |
download | aur-6233e3b3af8f0c15fee71b0b4995db13bbfc55ba.tar.gz |
Add network-ups-tools-git
-rw-r--r-- | .SRCINFO | 26 | ||||
-rw-r--r-- | PKGBUILD | 63 | ||||
-rw-r--r-- | nut.install | 18 | ||||
-rw-r--r-- | upsd.init | 43 |
4 files changed, 150 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..e9d4c78cbc58 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,26 @@ +pkgbase = network-ups-tools-git + pkgdesc = NUT is a collection of programs for monitoring and administering UPS hardware + pkgver = v2.7.1.signed.r8.gb11d66f + pkgrel = 2 + url = http://www.networkupstools.org/ + install = nut.install + arch = i686 + arch = x86_64 + license = GPL2 + makedepends = asciidoc + depends = openssl + depends = libusb-compat + provides = network-ups-tools + conflicts = network-ups-tools + backup = etc/ups/ups.conf + backup = etc/ups/upsd.conf + backup = etc/ups/upsd.users + backup = etc/ups/upsmon.conf + backup = etc/ups/upssched.conf + source = git+https://github.com/networkupstools/nut.git + source = upsd.init + md5sums = SKIP + md5sums = 089ea4a56552253328d17603ff5670cc + +pkgname = network-ups-tools-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..1848d42e9d18 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,63 @@ +# Maintainer: Florian Bruhin <archlinux.org@the-compiler.org> +# Contributor: Alex Reznichenko <sa5gap@yandex.ru> +# Contributor: Roman Kyrylych <roman@archlinux.org> +# Contributor: Giuseppe Lucarelli <luk@rebelsoft.org> + +pkgname=network-ups-tools-git +pkgver=v2.7.1.signed.r8.gb11d66f +pkgrel=2 +pkgdesc="NUT is a collection of programs for monitoring and administering UPS hardware" +arch=('i686' 'x86_64') +url="http://www.networkupstools.org/" +license=('GPL2') +depends=('openssl' 'libusb-compat') +provides=('network-ups-tools') +conflicts=('network-ups-tools') +makedepends=('asciidoc') +backup=(etc/ups/{ups.conf,upsd.conf,upsd.users,upsmon.conf,upssched.conf}) +install=nut.install +source=("git+https://github.com/networkupstools/nut.git" + 'upsd.init') +options=() +md5sums=('SKIP' + '089ea4a56552253328d17603ff5670cc') + +pkgver() { + cd "$srcdir/nut" + git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g' +} + +prepare() { + find "$srcdir/nut" -name '*.py' -exec sed -i 's|^#!/usr/bin/env python|&2|' {} \; +} + +build() { + cd "$srcdir/nut" + ./autogen.sh + ./configure \ + --without-wrap \ + --with-user=ups \ + --with-group=nut \ + --with-usb \ + --prefix=/usr \ + --with-udev-dir=/usr/lib/udev \ + --with-systemdsystemunitdir=/lib/systemd/system \ + --datadir=/usr/share/ups \ + --sbindir=/usr/bin \ + --with-drvpath=/usr/bin \ + --sysconfdir=/etc/ups + + make +} + +package() { + cd "$srcdir/nut" + make DESTDIR="$pkgdir" install + + install -D -m755 "$srcdir/upsd.init" "$pkgdir/etc/rc.d/upsd" + install -D -m644 conf/ups.conf.sample "$pkgdir/etc/ups/ups.conf" + install -D -m640 conf/upsd.conf.sample "$pkgdir/etc/ups/upsd.conf" + install -D -m640 conf/upsd.users.sample "$pkgdir/etc/ups/upsd.users" + install -D -m640 conf/upsmon.conf.sample "$pkgdir/etc/ups/upsmon.conf" + install -D -m644 conf/upssched.conf.sample "$pkgdir/etc/ups/upssched.conf" +} diff --git a/nut.install b/nut.install new file mode 100644 index 000000000000..1eca341b939d --- /dev/null +++ b/nut.install @@ -0,0 +1,18 @@ +post_install() { + groupadd -g 55 nut &> /dev/null + useradd -u 55 -g nut -G tty -d /var/state/ups -s /bin/false ups >/dev/null 2>&1 + mkdir -p /var/state/ups/ + chmod 0770 /var/state/ups/ + chown root:nut /var/state/ups/ + chown root:nut /etc/ups/upsd.conf /etc/ups/upsd.users /etc/ups/upsmon.conf + echo ">>> Before starting your UPSd daemon, you must" + echo ">>> edit /etc/ups/ups.conf in order to set your" + echo ">>> UPS driver and port." +} + +pre_remove() { + userdel ups >/dev/null 2>&1 + groupdel nut >/dev/null 2>&1 + rm -rf /var/state/ups/ +} + diff --git a/upsd.init b/upsd.init new file mode 100644 index 000000000000..acdd1152b058 --- /dev/null +++ b/upsd.init @@ -0,0 +1,43 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PID=`pidof -o %PPID /usr/sbin/upsd` +case "$1" in + start) + stat_busy "Starting UPSd Daemon" + /usr/bin/upsdrvctl start &> /dev/null + [ -z "$PID" ] && /usr/sbin/upsd &>/dev/null + /usr/sbin/upsmon &>/dev/null + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon upsd + stat_done + fi + ;; + + stop) + stat_busy "Stopping UPSd Daemon" + /usr/sbin/upsmon -c stop &> /dev/null + /usr/sbin/upsd -c stop &> /dev/null + /usr/bin/upsdrvctl stop &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon upsd + stat_done + fi + ;; + + restart) + $0 stop + sleep 3 + $0 start + ;; + + *) + cho "usage: $0 {start|stop|restart}" +esac +exit 0 |