~alpine/aports

[alpine-aports] [PATCH] testing/nut: fix user creation in post-install

Details
Message ID
<20170421133733.20203-1-valery.kartel@gmail.com>
Sender timestamp
1492781853
DKIM signature
missing
Download raw message
Patch: +33 -38
--
add nut home dir /var/lib/nut used for scheduler
fix libexec and driver dirs (libexec -> lib)
add using dns in init-scripts
remove conf.d files from package because it have no sence for now
cleanups in APKBUILD and init-scripts
---
 testing/nut/APKBUILD        | 48 ++++++++++++++++++++++-----------------------
 testing/nut/nut.confd       |  2 --
 testing/nut/nut.pre-install |  7 ++-----
 testing/nut/upsd.initd      |  7 ++++---
 testing/nut/upsmon.initd    |  7 ++++---
 5 files changed, 33 insertions(+), 38 deletions(-)
 delete mode 100644 testing/nut/nut.confd

diff --git a/testing/nut/APKBUILD b/testing/nut/APKBUILD
index 4ec2f85cf5..7f31f5df18 100644
--- a/testing/nut/APKBUILD
+++ b/testing/nut/APKBUILD
@@ -3,19 +3,18 @@
# Maintainer: Kozak Ivan <kozak-iv@yandex.ru>
pkgname=nut
pkgver=2.7.4
pkgrel=2
pkgdesc="Network UPS tools - server"
pkgrel=3
pkgdesc="Network UPS tools"
url="http://www.networkupstools.org"
arch="all"
license="GPL"
depends_dev="libressl-dev libusb-compat-dev net-snmp-dev neon-dev"
makedepends="$depends_dev libtool autoconf automake"
pkgusers="nut"
pkggroups="nut"
pkgusers=$pkgname
pkggroups=$pkgname
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-dev"
source="http://www.networkupstools.org/source/2.7/$pkgname-$pkgver.tar.gz
	nut.confd
	upsd.initd
	upsmon.initd
	"
@@ -27,10 +26,10 @@ build() {
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libexecdir=/lib/nut \
		--libexecdir=/usr/lib/nut \
		--without-wrap \
		--with-user=nut	\
		--with-group=nut \
		--with-user=$pkgname \
		--with-group=$pkgname \
		--disable-static \
		--with-serial \
		--with-usb \
@@ -42,7 +41,7 @@ build() {
		--without-freeipmi \
		--with-libltdl \
		--without-cgi \
		--with-drvpath=/usr/libexec/nut \
		--with-drvpath=/usr/lib/nut \
		--datadir=/usr/share/nut \
		--sysconfdir=/etc/nut \
		--with-statepath=/var/run/nut \
@@ -52,25 +51,24 @@ build() {
	make || return 1
}

package() {
	local i
	cd "$builddir"

	make DESTDIR="$pkgdir" install || return 1
	chmod -R 640 "$pkgdir"/etc/nut || return 1
	chown -R root:nut "$pkgdir"/etc/nut || return 1
check() {
	make -C "$builddir" check
}

	for i in "$pkgdir"/etc/nut/*.sample; do
		mv $i ${i%.*} || return 1
	done
package() {
	make -C "$builddir" DESTDIR="$pkgdir" install || return 1
	install -Dm755 "$srcdir"/upsd.initd "$pkgdir"/etc/init.d/nut-upsd || return 1
	install -Dm755 "$srcdir"/upsmon.initd "$pkgdir"/etc/init.d/nut-upsmon || return 1
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname || return 1

	for i in upsd upsmon; do
		install -Dm 755 "$srcdir"/$i.initd "$pkgdir"/etc/init.d/nut-$i || return 1
		install -Dm 644 "$srcdir"/nut.confd "$pkgdir"/etc/conf.d/nut-$i || return 1
	local file;
	for file in "$pkgdir"/etc/nut/*.sample; do
		chmod 640 $file || return 1
		chown root:$pkgname $file || return 1
		mv $file ${file%.sample} || return 1
	done
}

sha512sums="320c4aff85d8a370c5eff77d33924fdfc3caf6a250620693cdd5bf3336b3a80d8a207488eee841bcf8b72fbad68fda4c074e63b99c56e7886716fc934122d11a  nut-2.7.4.tar.gz
de59b3ab84553780874aeb9edf5faaa1fe19144406f58d40e878cc4cf520440d95a57645a6e3fdd84fdec77c6840ab2185b9554a423f7b9b8b6bca4a1795fb78  nut.confd
1a4b8ee42eb62b68170ef72e87115ae135905135d5d9bd48e837d18c73229c9da66e53cde4289faa1f4fdc2446195b3047bc1a66ae33bfb14cffb19dac403eb5  upsd.initd
d80f35af1e8ea2bb0da35af6a9bd2bfbc3b92d0cc0765a4d10d6cdce925225bb8200c7d9d2d77b1e5cc47593198dec3678403358538401f97644c61d8516adfb  upsmon.initd"
f470da96f9d324173e9bd241146284793738f99f2314dfe41c3ac3d56234394609b47d7e593ce9940ec7ce74a26a8483d0911161a16402cd3cc25023ba991d4b  upsd.initd
32470ae473fc363131787cd57f13d40763898947d56d032790ba7f3a5eaa8038b602f7e395ca44f6c5adce8ee5ec496e30ca0eaadb3c78a38015677aea751e12  upsmon.initd"
diff --git a/testing/nut/nut.confd b/testing/nut/nut.confd
deleted file mode 100644
index b24f2ff549..0000000000
--- a/testing/nut/nut.confd
@@ -1,2 +0,0 @@
# -4 Run IPv4 only, -6 for IPv6
#command_args="-4"
diff --git a/testing/nut/nut.pre-install b/testing/nut/nut.pre-install
index 2e3c642ca9..6d67c81a67 100644
--- a/testing/nut/nut.pre-install
+++ b/testing/nut/nut.pre-install
@@ -1,10 +1,7 @@
#!/bin/sh

if ! getent passwd nut; then
	addgroup -S -g 84 nut 2>/dev/null
	adduser -SDH -u 84 -h /run/nut -s /sbin/nologin -g nut nut 2>/dev/null
fi

addgroup -S nut 2>/dev/null
adduser -S -D -H -h /var/lib/nut -s /sbin/nologin -G nut -g nut nut 2>/dev/null
adduser nut uucp 2>/dev/null

exit 0
diff --git a/testing/nut/upsd.initd b/testing/nut/upsd.initd
index c765c59b87..0f891bce5d 100644
--- a/testing/nut/upsd.initd
+++ b/testing/nut/upsd.initd
@@ -1,13 +1,14 @@
#!/sbin/openrc-run

name=nut-server
name="UPS Server"
pidfile=/run/nut/upsd.pid
command=/usr/sbin/upsd
required_files="/etc/nut/nut.conf /etc/nut/upsd.conf"
extra_started_commands="reload"
start_stop_daemon_args="--quiet"

depend() {
	use net
	use net dns
}

start_pre() {
@@ -34,6 +35,6 @@ stop_post() {

reload() {
	ebegin "Reloading $name"
	start-stop-daemon --signal HUP --pidfile "$pidfile"
	start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}
diff --git a/testing/nut/upsmon.initd b/testing/nut/upsmon.initd
index 62adaf22dd..4a7efe8ba4 100644
--- a/testing/nut/upsmon.initd
+++ b/testing/nut/upsmon.initd
@@ -1,19 +1,20 @@
#!/sbin/openrc-run

name=nut-monitor
name="UPS Monitor"
pidfile=/run/upsmon.pid
command=/usr/sbin/upsmon
required_files="/etc/nut/nut.conf /etc/nut/upsmon.conf"
extra_started_commands="reload"
start_stop_daemon_args="--quiet"

depend() {
	use net
	. /etc/nut/nut.conf
	case $MODE in
	standalone|netserver)
		need nut-upsd
		;;
	esac
	use net dns
}

start_pre() {
@@ -29,6 +30,6 @@ start_pre() {

reload() {
	ebegin "Reloading $name"
	start-stop-daemon --signal HUP --pidfile ${pidfile}
	start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}
-- 
2.12.2



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)