Skip to content

Instantly share code, notes, and snippets.

@zman0900
Last active January 4, 2016 21:39
Show Gist options
  • Save zman0900/8682369 to your computer and use it in GitHub Desktop.
Save zman0900/8682369 to your computer and use it in GitHub Desktop.
Arch PKGBUILD for network-ups-tools 2.7.1-1
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/
}
# Maintainer: Alex Reznichenko <[email protected]>
# Contributor: Roman Kyrylych <[email protected]>
# Contributor: Giuseppe Lucarelli <[email protected]>
# Contributor: Dan Ziemba <[email protected]>
pkgname=network-ups-tools
pkgver=2.7.1
pkgrel=1
pkgdesc="NUT is a collection of programs for monitoring and administering UPS hardware"
# User travesh reports this works on arm, debian's package supports 'all',
# so this will probably work on anything.
arch=('i686' 'x86_64' 'armv5h' 'armv6h' 'armv7h')
url="http://www.networkupstools.org/"
license=('GPL2')
depends=('openssl' 'libusb-compat' 'net-snmp' 'neon' 'libltdl')
makedepends=('asciidoc')
backup=(etc/ups/{ups.conf,upsd.conf,upsd.users,upsmon.conf,upssched.conf})
install=nut.install
source=("http://www.networkupstools.org/source/2.7/nut-$pkgver.tar.gz")
options=('!emptydirs' '!libtool')
md5sums=('e64cf832063ecd6645683fc2ac2bd564')
prepare() {
cd $srcdir/nut-$pkgver
./configure \
--without-wrap \
--with-user=ups \
--with-group=nut \
--disable-static \
--with-serial \
--with-usb \
--with-doc=html-single \
--without-avahi \
--with-snmp \
--with-neon \
--without-powerman \
--without-ipmi \
--without-freeipmi \
--with-libltdl \
--without-cgi \
--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 \
--with-openssl
}
build() {
cd $srcdir/nut-$pkgver
make
}
package() {
cd $srcdir/nut-$pkgver
make DESTDIR=$pkgdir install
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
install -d -v -m755 $pkgdir/usr/share/doc/network-ups-tools/images/cables
install -v -m 644 docs/*.html $pkgdir/usr/share/doc/network-ups-tools
install -v -m 644 docs/images/*.png $pkgdir/usr/share/doc/network-ups-tools/images
install -v -m 644 docs/images/cables/*.png $pkgdir/usr/share/doc/network-ups-tools/images/cables
install -v -m 644 docs/images/cables/*.jpg $pkgdir/usr/share/doc/network-ups-tools/images/cables
# Fix broken systemd unit
cd $pkgdir
sed -i 's|=/upsdrvctl|=/usr/bin/upsdrvctl|' usr/lib/systemd/system/nut-driver.service
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment