aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nut
diff options
context:
space:
mode:
authorKozak Ivan <kozak-iv@yandex.ru>2014-03-02 17:19:40 +0400
committerNatanael Copa <ncopa@alpinelinux.org>2014-03-05 08:46:31 +0000
commitfe700e6fdc9e67500ea013d4399313e016a6339e (patch)
treecfa257f79e71c795ec7f28cfc8d73181d4e5e108 /testing/nut
parentbbbc4046f1f6d0370fc63ced842cdd67adbe093f (diff)
downloadaports-fe700e6fdc9e67500ea013d4399313e016a6339e.tar.bz2
aports-fe700e6fdc9e67500ea013d4399313e016a6339e.tar.xz
testing/nut: new aport
Diffstat (limited to 'testing/nut')
-rw-r--r--testing/nut/APKBUILD99
-rw-r--r--testing/nut/bcmxcp.patch178
-rw-r--r--testing/nut/nut-upsd.confd3
-rw-r--r--testing/nut/nut-upsd.initd53
-rw-r--r--testing/nut/nut-upsmon.confd3
-rw-r--r--testing/nut/nut-upsmon.initd43
-rw-r--r--testing/nut/nut.pre-install4
7 files changed, 383 insertions, 0 deletions
diff --git a/testing/nut/APKBUILD b/testing/nut/APKBUILD
new file mode 100644
index 0000000000..d6929df1a8
--- /dev/null
+++ b/testing/nut/APKBUILD
@@ -0,0 +1,99 @@
+# Contributor: Kozak Ivan <kozak-iv@yandex.ru>
+# Maintainer: Kozak Ivan <kozak-iv@yandex.ru>
+pkgname=nut
+pkgver=2.7.1
+pkgrel=0
+pkgdesc="Network UPS tools - server"
+url="http://www.networkupstools.org"
+arch="all"
+license="GPL"
+depends_dev="libusb-compat-dev net-snmp-dev neon-dev libtool"
+makedepends="$depends_dev"
+pkgusers="nut"
+pkggroups="nut"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc $pkgname-dev"
+source="http://www.networkupstools.org/source/2.7/$pkgname-$pkgver.tar.gz
+ bcmxcp.patch
+ nut-upsd.initd
+ nut-upsd.confd
+ nut-upsmon.initd
+ nut-upsmon.confd"
+
+# bcmxcp.patch - sorry no bcmxc and no bcmxcp_usb (get errors about undefined reference to `ldexp')
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ local i
+ cd "$srcdir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ ./configure --without-wrap \
+ --with-user=nut \
+ --with-group=nut \
+ --disable-static \
+ --with-serial \
+ --with-usb \
+ --without-avahi \
+ --with-snmp \
+ --with-neon \
+ --without-powerman \
+ --without-ipmi \
+ --without-freeipmi \
+ --with-libltdl \
+ --without-cgi \
+ --prefix=/usr \
+ --with-drvpath=/usr/libexec/nut \
+ --datadir=/usr/share/nut \
+ --sysconfdir=/etc/nut \
+ --with-statepath=/var/run/nut \
+ --with-altpidpath=/var/run/nut \
+ --with-openssl
+
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make DESTDIR="$pkgdir" install || return 1
+ chmod 640 "$pkgdir"/etc/nut/* || return 1
+ chown root:nut "$pkgdir"/etc/nut/* || return 1
+ install -D -m0755 "$srcdir"/nut-upsd.initd "$pkgdir"/etc/init.d/nut-upsd || return 1
+ install -D -m0644 "$srcdir"/nut-upsd.confd "$pkgdir"/etc/conf.d/nut-upsd || return 1
+ install -D -m0755 "$srcdir"/nut-upsmon.initd "$pkgdir"/etc/init.d/nut-upsmon || return 1
+ install -D -m0644 "$srcdir"/nut-upsmon.confd "$pkgdir"/etc/conf.d/nut-upsmon || return 1
+ #install -d -o nut -g nut -m700 "$pkgdir"/var/lib/nut || return 1
+ #for file in "$pkgdir"/etc/nut/*.sample
+ #do
+ # mv $file "$pkgdir"/etc/nut/`basename $file .sample`
+ #done
+
+ rm -f "$pkgdir"/usr/lib/*.la
+}
+
+md5sums="e64cf832063ecd6645683fc2ac2bd564 nut-2.7.1.tar.gz
+e32d263cac299d26c8109053d22dfdcf bcmxcp.patch
+e981e4ff27c0fc455ad2f319cbf29c36 nut-upsd.initd
+6b068c71884f8d66b5b7395b4a14d821 nut-upsd.confd
+21f6121acfeb17d51376bb0d11518804 nut-upsmon.initd
+6b068c71884f8d66b5b7395b4a14d821 nut-upsmon.confd"
+sha256sums="71a6d73ad6d910808126ba7f217ec1142a0c6709c63a22a099e7338960b2c798 nut-2.7.1.tar.gz
+60c9b0b3cea00887f4d7e9e3ebc2644617bb511b4601bbae0b0473b9db5dcd90 bcmxcp.patch
+afb6878a67a6effc9199b24dbcc4be20a799abbd370d8ebcfe09d05bb1ba11d6 nut-upsd.initd
+8ee7ff65c3ef84bb1bc0b458ff5b574bb8a6ac656a6d3a40441185b352481dda nut-upsd.confd
+0dfbc87ff6bb6c66132ecf4d7d09710ba34343e7cf42733484fa2df77b9be4cb nut-upsmon.initd
+8ee7ff65c3ef84bb1bc0b458ff5b574bb8a6ac656a6d3a40441185b352481dda nut-upsmon.confd"
+sha512sums="087c63b12f44c1b0caf8ffb2c5fda213a1b2060bdc284bd7fdff38a58f190c513790438388a4ceda8772938ae56ac84ca8635666ad89f067bec4d818252158ae nut-2.7.1.tar.gz
+9b43a749c7ace6a908bf0c4a23c04411ca755b872c80ad8c2d9be24ac6669978b969c2a8aa1bb0b23a1c53e912ca7ec2e315fc7e4ce301ac9b4aac41f573dfed bcmxcp.patch
+a0a205805a7cd7bc70163d9b50e51f16e74af22a799f74b1155430ca65090d64af972070d04759e4ac8e83e088bcbc531d9e9abd38482f74a885965ff0dc0ed8 nut-upsd.initd
+cf93ce44cb6fcf980f48f77abeeabb8d0b4008e8258cf7085d68b2a9c5c10c818dbf0030630218fcf8d9c9aba43c06bda28f91efca9cc783438ec0192f10eb5d nut-upsd.confd
+aa6efe85e874ada8b4cea0581bca6b8c24fa336fe1b197925519041f55b21d77683c31e2d8304fb45062cb52a55d44682981fcd22c7db0d2f8adf7e866324efe nut-upsmon.initd
+cf93ce44cb6fcf980f48f77abeeabb8d0b4008e8258cf7085d68b2a9c5c10c818dbf0030630218fcf8d9c9aba43c06bda28f91efca9cc783438ec0192f10eb5d nut-upsmon.confd"
diff --git a/testing/nut/bcmxcp.patch b/testing/nut/bcmxcp.patch
new file mode 100644
index 0000000000..644d9b7eff
--- /dev/null
+++ b/testing/nut/bcmxcp.patch
@@ -0,0 +1,178 @@
+--- Makefile.in
++++ src/nut-2.7.1/drivers/Makefile.in
+@@ -135,7 +135,7 @@
+ am_libnuthalmain_a_OBJECTS = main-hal.$(OBJEXT) dstate-hal.$(OBJEXT) \
+ usb-common.$(OBJEXT)
+ libnuthalmain_a_OBJECTS = $(am_libnuthalmain_a_OBJECTS)
+-am__EXEEXT_1 = al175$(EXEEXT) bcmxcp$(EXEEXT) belkin$(EXEEXT) \
++am__EXEEXT_1 = al175$(EXEEXT) belkin$(EXEEXT) \
+ belkinunv$(EXEEXT) bestfcom$(EXEEXT) bestfortress$(EXEEXT) \
+ bestuferrups$(EXEEXT) bestups$(EXEEXT) dummy-ups$(EXEEXT) \
+ etapro$(EXEEXT) everups$(EXEEXT) gamatronic$(EXEEXT) \
+@@ -151,7 +151,7 @@
+ apcsmart-old$(EXEEXT) apcupsd-ups$(EXEEXT) riello_ser$(EXEEXT) \
+ nutdrv_qx$(EXEEXT)
+ am__EXEEXT_2 = snmp-ups$(EXEEXT)
+-am__EXEEXT_3 = usbhid-ups$(EXEEXT) bcmxcp_usb$(EXEEXT) \
++am__EXEEXT_3 = usbhid-ups$(EXEEXT) \
+ tripplite_usb$(EXEEXT) blazer_usb$(EXEEXT) \
+ richcomm_usb$(EXEEXT) riello_usb$(EXEEXT) nutdrv_qx$(EXEEXT)
+ am__EXEEXT_4 = $(am__EXEEXT_3)
+@@ -168,7 +168,6 @@
+ am__installdirs = "$(DESTDIR)$(driverexecdir)" \
+ "$(DESTDIR)$(halexecdir)"
+ am__EXEEXT_14 = hald-addon-usbhid-ups$(EXEEXT) \
+- hald-addon-bcmxcp_usb$(EXEEXT) \
+ hald-addon-tripplite_usb$(EXEEXT) \
+ hald-addon-blazer_usb$(EXEEXT) hald-addon-riello_usb$(EXEEXT) \
+ hald-addon-nutdrv_qx$(EXEEXT)
+@@ -193,14 +192,7 @@
+ apcupsd_ups_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(apcupsd_ups_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+-am_bcmxcp_OBJECTS = bcmxcp.$(OBJEXT) bcmxcp_ser.$(OBJEXT)
+-bcmxcp_OBJECTS = $(am_bcmxcp_OBJECTS)
+ am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
+-bcmxcp_DEPENDENCIES = $(am__DEPENDENCIES_3)
+-am_bcmxcp_usb_OBJECTS = bcmxcp_usb.$(OBJEXT) bcmxcp.$(OBJEXT) \
+- usb-common.$(OBJEXT)
+-bcmxcp_usb_OBJECTS = $(am_bcmxcp_usb_OBJECTS)
+-bcmxcp_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1)
+ am_belkin_OBJECTS = belkin.$(OBJEXT)
+ belkin_OBJECTS = $(am_belkin_OBJECTS)
+ belkin_LDADD = $(LDADD)
+@@ -264,11 +256,6 @@
+ genericups_OBJECTS = $(am_genericups_OBJECTS)
+ genericups_LDADD = $(LDADD)
+ genericups_DEPENDENCIES = $(am__DEPENDENCIES_2)
+-am_hald_addon_bcmxcp_usb_OBJECTS = bcmxcp_usb.$(OBJEXT) \
+- bcmxcp.$(OBJEXT)
+-hald_addon_bcmxcp_usb_OBJECTS = $(am_hald_addon_bcmxcp_usb_OBJECTS)
+-hald_addon_bcmxcp_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \
+- $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+ am_hald_addon_blazer_usb_OBJECTS = blazer.$(OBJEXT) \
+ blazer_usb.$(OBJEXT) libusb.$(OBJEXT)
+ hald_addon_blazer_usb_OBJECTS = $(am_hald_addon_blazer_usb_OBJECTS)
+@@ -486,13 +473,11 @@
+ $(LDFLAGS) -o $@
+ SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \
+ $(al175_SOURCES) $(apcsmart_SOURCES) $(apcsmart_old_SOURCES) \
+- $(apcupsd_ups_SOURCES) $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) \
+ $(belkin_SOURCES) $(belkinunv_SOURCES) $(bestfcom_SOURCES) \
+ bestfortress.c $(bestuferrups_SOURCES) $(bestups_SOURCES) \
+ $(blazer_ser_SOURCES) $(blazer_usb_SOURCES) $(clone_SOURCES) \
+ $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \
+ $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \
+- $(hald_addon_bcmxcp_usb_SOURCES) \
+ $(hald_addon_blazer_usb_SOURCES) \
+ $(hald_addon_nutdrv_qx_SOURCES) \
+ $(hald_addon_riello_usb_SOURCES) \
+@@ -514,13 +499,12 @@
+ $(victronups_SOURCES)
+ DIST_SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \
+ $(al175_SOURCES) $(apcsmart_SOURCES) $(apcsmart_old_SOURCES) \
+- $(apcupsd_ups_SOURCES) $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) \
++ $(apcupsd_ups_SOURCES) \
+ $(belkin_SOURCES) $(belkinunv_SOURCES) $(bestfcom_SOURCES) \
+ bestfortress.c $(bestuferrups_SOURCES) $(bestups_SOURCES) \
+ $(blazer_ser_SOURCES) $(blazer_usb_SOURCES) $(clone_SOURCES) \
+ $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \
+ $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \
+- $(hald_addon_bcmxcp_usb_SOURCES) \
+ $(hald_addon_blazer_usb_SOURCES) \
+ $(hald_addon_nutdrv_qx_SOURCES) \
+ $(hald_addon_riello_usb_SOURCES) \
+@@ -751,7 +735,7 @@
+ AM_CFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \
+ $(am__append_3) $(am__append_4) $(am__append_5) \
+ $(am__append_6)
+-SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \
++SERIAL_DRIVERLIST = al175 belkin belkinunv bestfcom \
+ bestfortress bestuferrups bestups dummy-ups etapro everups \
+ gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \
+ oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \
+@@ -760,11 +744,11 @@
+ nutdrv_qx
+
+ SNMP_DRIVERLIST = snmp-ups
+-USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \
++USB_LIBUSB_DRIVERLIST = usbhid-ups tripplite_usb \
+ blazer_usb richcomm_usb riello_usb nutdrv_qx
+
+ USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST)
+-HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \
++HAL_DRIVERLIST = hald-addon-usbhid-ups \
+ hald-addon-tripplite_usb hald-addon-blazer_usb hald-addon-riello_usb \
+ hald-addon-nutdrv_qx
+
+@@ -783,8 +767,6 @@
+ al175_SOURCES = al175.c
+ apcsmart_SOURCES = apcsmart.c apcsmart_tabs.c
+ apcsmart_old_SOURCES = apcsmart-old.c
+-bcmxcp_SOURCES = bcmxcp.c bcmxcp_ser.c
+-bcmxcp_LDADD = $(LDADD) -lm
+ belkin_SOURCES = belkin.c
+ belkinunv_SOURCES = belkinunv.c
+ bestfcom_SOURCES = bestfcom.c
+@@ -858,8 +840,6 @@
+ usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
+ tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c
+ tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
+-bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c
+-bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS)
+ blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c
+ blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm
+ richcomm_usb_SOURCES = richcomm_usb.c usb-common.c
+@@ -887,8 +867,6 @@
+ hald_addon_usbhid_ups_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS)
+ hald_addon_tripplite_usb_SOURCES = tripplite_usb.c libusb.c
+ hald_addon_tripplite_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm
+-hald_addon_bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c
+-hald_addon_bcmxcp_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS)
+ hald_addon_blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c
+ hald_addon_blazer_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm
+ hald_addon_riello_usb_SOURCES = riello.c riello_usb.c libusb.c
+@@ -929,8 +907,8 @@
+ # List of header files. The purpose of this list is not dependency
+ # tracking (which is automatic), but to ensure these files are
+ # distributed by "make dist".
+-dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \
+- bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \
++dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h \
++ belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \
+ dstate-hal.h dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.h \
+ hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h libusb.h liebert-hid.h \
+ main.h main-hal.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.h \
+@@ -1102,12 +1080,6 @@
+ apcupsd-ups$(EXEEXT): $(apcupsd_ups_OBJECTS) $(apcupsd_ups_DEPENDENCIES) $(EXTRA_apcupsd_ups_DEPENDENCIES)
+ @rm -f apcupsd-ups$(EXEEXT)
+ $(apcupsd_ups_LINK) $(apcupsd_ups_OBJECTS) $(apcupsd_ups_LDADD) $(LIBS)
+-bcmxcp$(EXEEXT): $(bcmxcp_OBJECTS) $(bcmxcp_DEPENDENCIES) $(EXTRA_bcmxcp_DEPENDENCIES)
+- @rm -f bcmxcp$(EXEEXT)
+- $(LINK) $(bcmxcp_OBJECTS) $(bcmxcp_LDADD) $(LIBS)
+-bcmxcp_usb$(EXEEXT): $(bcmxcp_usb_OBJECTS) $(bcmxcp_usb_DEPENDENCIES) $(EXTRA_bcmxcp_usb_DEPENDENCIES)
+- @rm -f bcmxcp_usb$(EXEEXT)
+- $(LINK) $(bcmxcp_usb_OBJECTS) $(bcmxcp_usb_LDADD) $(LIBS)
+ belkin$(EXEEXT): $(belkin_OBJECTS) $(belkin_DEPENDENCIES) $(EXTRA_belkin_DEPENDENCIES)
+ @rm -f belkin$(EXEEXT)
+ $(LINK) $(belkin_OBJECTS) $(belkin_LDADD) $(LIBS)
+@@ -1153,9 +1125,6 @@
+ genericups$(EXEEXT): $(genericups_OBJECTS) $(genericups_DEPENDENCIES) $(EXTRA_genericups_DEPENDENCIES)
+ @rm -f genericups$(EXEEXT)
+ $(LINK) $(genericups_OBJECTS) $(genericups_LDADD) $(LIBS)
+-hald-addon-bcmxcp_usb$(EXEEXT): $(hald_addon_bcmxcp_usb_OBJECTS) $(hald_addon_bcmxcp_usb_DEPENDENCIES) $(EXTRA_hald_addon_bcmxcp_usb_DEPENDENCIES)
+- @rm -f hald-addon-bcmxcp_usb$(EXEEXT)
+- $(LINK) $(hald_addon_bcmxcp_usb_OBJECTS) $(hald_addon_bcmxcp_usb_LDADD) $(LIBS)
+ hald-addon-blazer_usb$(EXEEXT): $(hald_addon_blazer_usb_OBJECTS) $(hald_addon_blazer_usb_DEPENDENCIES) $(EXTRA_hald_addon_blazer_usb_DEPENDENCIES)
+ @rm -f hald-addon-blazer_usb$(EXEEXT)
+ $(LINK) $(hald_addon_blazer_usb_OBJECTS) $(hald_addon_blazer_usb_LDADD) $(LIBS)
+@@ -1288,9 +1257,6 @@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart_tabs.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/baytech-mib.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_ser.Po@am__quote@
+-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_usb.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin-hid.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin.Po@am__quote@
+ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkinunv.Po@am__quote@
diff --git a/testing/nut/nut-upsd.confd b/testing/nut/nut-upsd.confd
new file mode 100644
index 0000000000..ab4cb59564
--- /dev/null
+++ b/testing/nut/nut-upsd.confd
@@ -0,0 +1,3 @@
+CONFIG=/etc/nut/nut.conf
+# Run IPv4 only, -6 for IPv6
+ARGS="-4 -u nut"
diff --git a/testing/nut/nut-upsd.initd b/testing/nut/nut-upsd.initd
new file mode 100644
index 0000000000..dcc3b595be
--- /dev/null
+++ b/testing/nut/nut-upsd.initd
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+
+extra_started_commands="reload"
+
+pid_dir=/var/run/nut
+pidfile=/var/run/nut/upsd.pid
+upsd=/usr/sbin/upsd
+upsdrvctl=/usr/libexec/nut/upsdrvctl
+NAME=nut-server
+
+depend() {
+ use net
+ before nut-upsmon
+}
+
+start_pre()
+{
+ # Ensure that our dirs are correct
+ checkpath -d --owner root:nut --mode 0770 $pid_dir
+}
+
+start() {
+ ebegin "Starting upsd"
+
+ # Include NUT nut.conf
+ [ -r $CONFIG ] && . $CONFIG
+
+ # Explicitly require the configuration to be done in /etc/nut/nut.conf
+ # redundant with nut-client
+ if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
+ eerror "$NAME disabled, please adjust the configuration to your needs"
+ eerror "Then set MODE to a suitable value in $CONFIG to enable it"
+ # exit success to avoid breaking the install process!
+ return 1
+ fi
+
+ ${upsdrvctl} -u nut start &>/dev/null
+ start-stop-daemon --start --pidfile ${pidfile} --exec ${upsd} -- ${ARGS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsd"
+ start-stop-daemon --stop --pidfile ${pidfile}
+ ${upsdrvctl} -u nut stop &>/dev/null
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsd"
+ start-stop-daemon --stop --signal HUP --pidfile ${pidfile}
+ eend $?
+}
diff --git a/testing/nut/nut-upsmon.confd b/testing/nut/nut-upsmon.confd
new file mode 100644
index 0000000000..ab4cb59564
--- /dev/null
+++ b/testing/nut/nut-upsmon.confd
@@ -0,0 +1,3 @@
+CONFIG=/etc/nut/nut.conf
+# Run IPv4 only, -6 for IPv6
+ARGS="-4 -u nut"
diff --git a/testing/nut/nut-upsmon.initd b/testing/nut/nut-upsmon.initd
new file mode 100644
index 0000000000..53f1b1bacf
--- /dev/null
+++ b/testing/nut/nut-upsmon.initd
@@ -0,0 +1,43 @@
+#!/sbin/runscript
+
+extra_started_commands="reload"
+
+pidfile=/var/run/upsmon.pid
+upsmon=/usr/sbin/upsmon
+NAME=nut-monitor
+
+depend() {
+ use net
+ after nut-upsd
+}
+
+start() {
+ ebegin "Starting upsmon"
+
+ # Include NUT nut.conf
+ [ -r $CONFIG ] && . $CONFIG
+
+ # Explicitly require the configuration to be done in /etc/nut/nut.conf
+ # redundant with nut-client
+ if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then
+ eerror "$NAME disabled, please adjust the configuration to your needs"
+ eerror "Then set MODE to a suitable value in $CONFIG to enable it"
+ # exit success to avoid breaking the install process!
+ return 1
+ fi
+
+ start-stop-daemon --start --pidfile ${pidfile} --exec ${upsmon} -- ${ARGS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping upsmon"
+ start-stop-daemon --stop --pidfile ${pidfile}
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading upsmon"
+ start-stop-daemon --stop --signal HUP --pidfile ${pidfile}
+ eend $?
+}
diff --git a/testing/nut/nut.pre-install b/testing/nut/nut.pre-install
new file mode 100644
index 0000000000..cea4d7f5a8
--- /dev/null
+++ b/testing/nut/nut.pre-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+adduser nut uucp 2>/dev/null
+exit 0