~alpine/aports

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[alpine-aports] [PATCH V2] main/dnsmasq: change default user/group, add config directory, cleanups in init script.

Details
Message ID
<20160616122941.8114-1-valery.kartel@gmail.com>
Sender timestamp
1466080181
DKIM signature
missing
Download raw message
Patch: +53 -48
---
 main/dnsmasq/APKBUILD         | 54 +++++++++++++++++++++++++------------------
 main/dnsmasq/dnsmasq.confd    |  5 ++--
 main/dnsmasq/dnsmasq.initd    | 29 +++++------------------
 main/dnsmasq/user_group.patch | 13 +++++++++++
 4 files changed, 53 insertions(+), 48 deletions(-)
 create mode 100644 main/dnsmasq/user_group.patch

diff --git a/main/dnsmasq/APKBUILD b/main/dnsmasq/APKBUILD
index ee9c814..4e958ce 100644
--- a/main/dnsmasq/APKBUILD
+++ b/main/dnsmasq/APKBUILD
@@ -1,7 +1,8 @@
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dnsmasq
pkgver=2.76
pkgrel=0
pkgrel=1
pkgdesc="Small forwarding DNS server"
url="http://www.thekelleys.org.uk/dnsmasq/"
arch="all"
@@ -9,42 +10,51 @@ license="GPL2"
depends=
makedepends="linux-headers"
install="$pkgname.pre-install $pkgname.pre-upgrade"
pkgusers="dnsmasq"
pkggroups="dnsmasq"
subpackages="$pkgname-doc"
source="http://www.thekelleys.org.uk/dnsmasq/$pkgname-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	user_group.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}

build() {
	cd "$srcdir/$pkgname-$pkgver"
	cd "$_builddir"
	sed -i -e 's/^AWK.*/AWK = awk/' Makefile
	make PREFIX=/usr \
		CFLAGS="$CFLAGS" \
		DBUS_LIBS= \
		DBUS_CFLAGS= \
		DBUS_MINOR= \
		all || return 1
	make CFLAGS="$CFLAGS" PREFIX=/usr all || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	make PREFIX=/usr \
		DESTDIR="$pkgdir" \
		DBUS_LIBS= \
		DBUS_CFLAGS= \
		DBUS_MINOR= \
		install
	cd "$_builddir"
	make DESTDIR="$pkgdir" PREFIX=/usr install || return 1
	install -D -m755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -D -m644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install dnsmasq.conf.example "$pkgdir"/etc/dnsmasq.conf
	install -m644 dnsmasq.conf.example "$pkgdir"/etc/dnsmasq.conf
	sed -i 's:#conf-dir=/etc/dnsmasq.d/:conf-dir=/etc/dnsmasq.d/:' \
		"$pkgdir"/etc/dnsmasq.conf || return 1
	install -d -m755 "$pkgdir"/etc/dnsmasq.d
}

md5sums="6610f8233ca89b15a1bb47c788ffb84f  dnsmasq-2.76.tar.gz
bfc91bcb341fd6d0f50eaeca1bb31cb0  dnsmasq.initd
16985abb08c8e11f85e38b37ea3863a4  dnsmasq.confd"
417c1c6607faed64bd5735d464d9345d  dnsmasq.initd
4fd013f2cee3afe28094f9e1fb950bb3  dnsmasq.confd
53bed407ebc76bea245f6e2d79c3955d  user_group.patch"
sha256sums="777c4762d2fee3738a0380401f2d087b47faa41db2317c60660d69ad10a76c32  dnsmasq-2.76.tar.gz
9105043609236d774c1f502c309b56cbc669ce0b5e39b424789bbf55f0842037  dnsmasq.initd
51c0672a70d5d6793d295d82db666d372fb081e8627318f67c88e48d08d254b5  dnsmasq.confd"
9ada9d5d6bb62c620b543fb388207f9e9ef77da8d3d94e26789c1ad28e6cc72f  dnsmasq.initd
a35c6a2fc158d812e290489fd6b090261f978e5a1d2019f70b2caeb61d1f94e3  dnsmasq.confd
3a4597ab00e1d618a0c1badd1509189643b4a51d708c071e482a1e506a7288c4  user_group.patch"
sha512sums="c22627a8d864671096d3b3428ec4f879b513e1f1e7f79be3ab89444c56234e748fbfa6b6b4f9e521984fea95d363f4aa2ca6243f0dfc12ffb74bed0648ae21c5  dnsmasq-2.76.tar.gz
a7c44bd4c7d04d881e561288ee4979378ee0cd72a812a5dc33a040aea40374a2cbcafb1b3b2a6fa07291ee0831b7d421f7a8749289213fe1fb3205163980bfa5  dnsmasq.initd
9a401bfc408bf1638645c61b8ca734bea0a09ef79fb36648ec7ef21666257234254bbe6c73c82cc23aa1779ddcdda0e6baa2c041866f16dfb9c4e0ba9133eab8  dnsmasq.confd"
47787414bb157cfda07bdda6a1f459324fbf7db9c31f19ac2c660860d1d24316f23d511cbb8ad880e178ae82f200ca9b0d05ff80c7902e67e5d1b70f06fafd5c  dnsmasq.initd
ad835012aaceadd8c67e3ebe1fe279d76b807f1a9d7f10195ddabf1b5f01f768b93605f7e0b24a262819f66a18fe097a5fc38ab54585b79e6516b179e278c7b2  dnsmasq.confd
4dcc9bd931843d95f578398c7ae735b9c6df5d63906854e748a1419d8cfcffb3332f899dccf87d9163778206ac3d8412c3113b895bb82a3bcd9ebbe8ec91080e  user_group.patch"
diff --git a/main/dnsmasq/dnsmasq.confd b/main/dnsmasq/dnsmasq.confd
index 0e94463..2700cd1 100644
--- a/main/dnsmasq/dnsmasq.confd
+++ b/main/dnsmasq/dnsmasq.confd
@@ -1,4 +1,3 @@
# /etc/conf.d/dnsmasq: config file for /etc/init.d/dnsmasq

# See the dnsmasq(8) man page for possible options to put here.
DNSMASQ_OPTS="--user=dnsmasq --group=dnsmasq"
#
#command_args=""
diff --git a/main/dnsmasq/dnsmasq.initd b/main/dnsmasq/dnsmasq.initd
index 0ebcb3c..2e43d13 100644
--- a/main/dnsmasq/dnsmasq.initd
+++ b/main/dnsmasq/dnsmasq.initd
@@ -1,13 +1,12 @@
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-dns/dnsmasq/files/dnsmasq-init-r1,v 1.2 2011/12/04 10:28:47 swegener Exp $

command=/usr/sbin/dnsmasq
pidfile=/var/run/dnsmasq.pid
required_files=/etc/dnsmasq.conf
extra_started_commands="reload"
description="Lightweight DNS, TFTP, PXE, router advertisement and DHCP server"
description_reload="Clear cache and reload hosts files"

extra_started_commands="reload"

depend() {
	provide dns
	need localmount net
@@ -15,24 +14,8 @@ depend() {
	use logger
}

start() {
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --start --exec /usr/sbin/dnsmasq \
	    --pidfile /var/run/dnsmasq.pid \
	    -- -x /var/run/dnsmasq.pid ${DNSMASQ_OPTS}
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --exec /usr/sbin/dnsmasq \
	    --pidfile /var/run/dnsmasq.pid
	eend $?
}

reload() {
	ebegin "Reloading ${SVCNAME}"
	start-stop-daemon --stop --oknodo --signal HUP \
	    --exec /usr/sbin/dnsmasq --pidfile /var/run/dnsmasq.pid
	ebegin "Reloading $SVCNAME"
	start-stop-daemon --signal HUP --pidfile $pidfile
	eend $?
}
diff --git a/main/dnsmasq/user_group.patch b/main/dnsmasq/user_group.patch
new file mode 100644
index 0000000..b7e4604
--- /dev/null
+++ b/main/dnsmasq/user_group.patch
@@ -0,0 +1,13 @@
--- a/src/config.h
+++ b/src/config.h
@@ -40,8 +40,8 @@
 #define HOSTSFILE "/etc/hosts"
 #define ETHERSFILE "/etc/ethers"
 #define DEFLEASE 3600 /* default lease time, 1 hour */
-#define CHUSER "nobody"
-#define CHGRP "dip"
+#define CHUSER "dnsmasq"
+#define CHGRP "dnsmasq"
 #define TFTP_MAX_CONNECTIONS 50 /* max simultaneous connections */
 #define LOG_MAX 5 /* log-queue length */
 #define RANDFILE "/dev/urandom"
-- 
2.8.4



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Bartłomiej Piotrowski <b@bpiotrowski.pl>
Details
Message ID
<41369f5f0c87accff0ee2c9f6428c45a@server-speed.net>
In-Reply-To
<20160616122941.8114-1-valery.kartel@gmail.com> (view parent)
Sender timestamp
1467883077
DKIM signature
missing
Download raw message
Hi,

Seems that dnsmasq supports --user and --groups flags so no patching is 
necessary. Are you sure about DBUS_* removal? We don't want to pull dbus 
by mistake.

Natanael mentioned he would prefer patching the configuration file 
instead of sed'ing it. Let me know if you are going to send another 
revision or you want me to make these changes.

Bartłomiej


---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Details
Message ID
<CAKTwcDMbG7SeucX=gmiUM+GB=FeMEzx_cSJNXusNEUAv3bjsiQ@mail.gmail.com>
In-Reply-To
<41369f5f0c87accff0ee2c9f6428c45a@server-speed.net> (view parent)
Sender timestamp
1467886448
DKIM signature
missing
Download raw message
Hi

Yes, dnsmasq supports command-line user/group. But I think it's better to
set them correctly at compile time to get rid of unnecessary entries in
init scripts and it would start correctly from command line without any
additional flags just out of the box.

Перекладач Google для компаній:Translator Toolkit
<http://www.google.com/url?rs=rsmf&q=http://translate.google.com/toolkit%3Fhl%3Duk>Інструмент
перекладу веб-сайтів
<http://www.google.com/url?rs=rsmf&q=http://translate.google.com/manager/website/%3Fhl%3Duk>Пошук
на світовому ринку
<http://www.google.com/url?rs=rsmf&q=http://translate.google.com/globalmarketfinder/%3Flocale%3Duk>

To compile with DBUS it's need to explictly set HAVE_DBUS. So DBUS_* flags
are useless.

I think it's have no sense to make a patch to change 1 line in config file.
But you decide.

2016-07-07 12:17 GMT+03:00 Bartłomiej Piotrowski <b@bpiotrowski.pl>:

> Hi,
>
> Seems that dnsmasq supports --user and --groups flags so no patching is
> necessary. Are you sure about DBUS_* removal? We don't want to pull dbus by
> mistake.
>
> Natanael mentioned he would prefer patching the configuration file instead
> of sed'ing it. Let me know if you are going to send another revision or you
> want me to make these changes.
>
> Bartłomiej
>
Reply to thread Export thread (mbox)