[arch-commits] Commit in pdnsd/trunk (PKGBUILD pdnsd.install)
Daniel Micay
thestinger at nymeria.archlinux.org
Tue Mar 25 02:20:56 UTC 2014
Date: Tuesday, March 25, 2014 @ 03:20:56
Author: thestinger
Revision: 108219
pdnsd: run as pdnsd user, not root
This also renames /etc/pdnsd.conf.sample to /etc/pdnsd.conf in order to
generate pacnew files. Otherwise, upgrades like this would cause silent
breakage.
Added:
pdnsd/trunk/pdnsd.install
Modified:
pdnsd/trunk/PKGBUILD
---------------+
PKGBUILD | 24 +++++++++++++++++-------
pdnsd.install | 22 ++++++++++++++++++++++
2 files changed, 39 insertions(+), 7 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2014-03-25 01:00:48 UTC (rev 108218)
+++ PKGBUILD 2014-03-25 02:20:56 UTC (rev 108219)
@@ -1,16 +1,19 @@
# $Id$
# Maintainer: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Contributor: Daniel Micay <danielmicay at gmail.com>
# Contributor: Henrik Nymann Jensen <h at henriknj.dk>
pkgname=pdnsd
pkgver=1.2.9.a
_pkgver=${pkgver/.a/a}
-pkgrel=4
+pkgrel=5
pkgdesc="Proxy DNS server with permanent caching"
arch=(i686 x86_64)
url="http://members.home.nl/p.a.rombouts/pdnsd/"
license=('GPL')
depends=('glibc')
+backup=(etc/pdnsd.conf)
+install=${pkgname}.install
source=(http://members.home.nl/p.a.rombouts/pdnsd/releases/pdnsd-$_pkgver-par.tar.gz
service)
md5sums=('2f3e705d59a0f9308ad9504b24400769'
@@ -17,13 +20,20 @@
'4f86bdbd8495b53341070d5720491996')
build() {
- cd $srcdir/$pkgname-${_pkgver}
- ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --enable-ipv6
- make
+ cd "$srcdir/$pkgname-$_pkgver"
+ ./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/bin --enable-ipv6
+ make
}
package() {
- cd $srcdir/$pkgname-${_pkgver}
- make DESTDIR=$pkgdir install
- install -Dm0644 $srcdir/service $pkgdir/usr/lib/systemd/system/pdnsd.service
+ cd "$srcdir/$pkgname-$_pkgver"
+ make DESTDIR="$pkgdir" install
+ install -Dm0644 ../service "$pkgdir/usr/lib/systemd/system/pdnsd.service"
+
+ # Rename the configuration file, so users get pacnew files.
+ mv "$pkgdir/etc/pdnsd.conf.sample" "$pkgdir/etc/pdnsd.conf"
+
+ sed -i 's/"nobody"/"pdnsd"/' "$pkgdir/etc/pdnsd.conf"
+
+ chown 184:184 "$pkgdir/var/cache/pdnsd"
}
Added: pdnsd.install
===================================================================
--- pdnsd.install (rev 0)
+++ pdnsd.install 2014-03-25 02:20:56 UTC (rev 108219)
@@ -0,0 +1,22 @@
+post_install() {
+ getent group pdnsd &>/dev/null || groupadd -g 184 pdnsd >/dev/null
+ getent passwd pdnsd &>/dev/null || useradd -u 184 -g pdnsd -d /var/lib/pdnsd -c 'Proxy DNS server' -s /bin/nologin pdnsd >/dev/null
+ true
+}
+
+post_upgrade() {
+ if [[ $(vercmp $2 1.2.9.a-5) -le 0 ]]; then
+ # in case the user/group were already created as recommended by the wiki
+ userdel pdnsd &>/dev/null
+ groupdel pdnsd &>/dev/null
+
+ post_install
+ chown -R 184:184 /var/cache/pdnsd
+ fi
+}
+
+post_remove() {
+ getent passwd pdnsd &>/dev/null && userdel pdnsd >/dev/null
+ getent group pdnsd &>/dev/null && groupdel pdnsd >/dev/null
+ true
+}
More information about the arch-commits
mailing list