summaryrefslogtreecommitdiff
path: root/extra/dnsmasq
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-09-21 12:47:04 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-09-21 12:47:04 -0300
commit79f56eaaa1e752a2f67072051b612acf5c648f69 (patch)
treea466c8fa3a070419d3a816b79a2d38ec80ad04ce /extra/dnsmasq
parent37ac99de3bc1df2e6c5e0cd8b6af631d589cb4ab (diff)
parentd739da01541d53414129d3171df221cfe2440fe5 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community/antiword/PKGBUILD community/apcupsd/PKGBUILD community/busybox/PKGBUILD community/chrpath/PKGBUILD community/driftnet/PKGBUILD community/emesene/PKGBUILD community/fdm/PKGBUILD community/fftw2/PKGBUILD community/gsynaptics/PKGBUILD community/gtk-rezlooks-engine/PKGBUILD community/httptunnel/PKGBUILD community/libnfnetlink/PKGBUILD community/libopenraw/PKGBUILD community/mashup/PKGBUILD community/pcb/PKGBUILD community/portaudio_cpp/PKGBUILD community/preload/PKGBUILD community/rlog/PKGBUILD community/scponly/PKGBUILD community/splint/PKGBUILD community/wmname/PKGBUILD community/xosd/PKGBUILD community/xxkb/PKGBUILD community/znc/PKGBUILD core/glibc/PKGBUILD core/libtool/PKGBUILD extra/at/PKGBUILD extra/autogen/PKGBUILD extra/bmp-musepack/PKGBUILD extra/capi4k-utils/PKGBUILD extra/cdrdao/PKGBUILD extra/chkrootkit/PKGBUILD extra/cmt/PKGBUILD extra/compface/PKGBUILD extra/dasher/PKGBUILD extra/dcfldd/PKGBUILD extra/dmapi/PKGBUILD extra/docker/PKGBUILD extra/dvd+rw-tools/PKGBUILD extra/dvdrtools/PKGBUILD extra/fcgi/PKGBUILD extra/festival/PKGBUILD extra/ffmpeg/PKGBUILD extra/gecko-sharp-2.0/PKGBUILD extra/gimp-gap/PKGBUILD extra/gmetadom/PKGBUILD extra/gnome-speech/PKGBUILD extra/gnome-vfsmm/PKGBUILD extra/gnutls/PKGBUILD extra/graphite/PKGBUILD extra/i8kutils/PKGBUILD extra/id3/PKGBUILD extra/java-access-bridge/PKGBUILD extra/kdelibs/PKGBUILD extra/koffice/PKGBUILD extra/ladspa/PKGBUILD extra/libcddb/PKGBUILD extra/libcroco/PKGBUILD extra/libdc1394/PKGBUILD extra/libdca/PKGBUILD extra/libgee/PKGBUILD extra/libglademm/PKGBUILD extra/libgnomecanvasmm/PKGBUILD extra/libsigsegv/PKGBUILD extra/libstdc++5/PKGBUILD extra/libwebkit/PKGBUILD extra/libytnef/PKGBUILD extra/lua/PKGBUILD extra/mcpp/PKGBUILD extra/metalog/PKGBUILD extra/mp3wrap/PKGBUILD extra/mt-st/PKGBUILD extra/naim/PKGBUILD extra/ocaml/PKGBUILD extra/oxine/PKGBUILD extra/php/PKGBUILD extra/poppler/PKGBUILD extra/pstoedit/PKGBUILD extra/qt/PKGBUILD extra/speex/PKGBUILD extra/sweep/PKGBUILD extra/t1lib/PKGBUILD extra/taglib-extras/PKGBUILD extra/unixodbc/PKGBUILD extra/wireshark/PKGBUILD extra/ypbind-mt/PKGBUILD gnome-unstable/caribou/PKGBUILD gnome-unstable/clutter/PKGBUILD gnome-unstable/cogl/PKGBUILD gnome-unstable/dconf/PKGBUILD gnome-unstable/empathy/PKGBUILD gnome-unstable/empathy/empathy.install gnome-unstable/eog/PKGBUILD gnome-unstable/evolution-data-server/PKGBUILD gnome-unstable/evolution/PKGBUILD gnome-unstable/folks/PKGBUILD gnome-unstable/gconf/PKGBUILD gnome-unstable/gdm/PKGBUILD gnome-unstable/gdm/fix_external_program_directories.patch gnome-unstable/glib-networking/PKGBUILD gnome-unstable/glib2/PKGBUILD gnome-unstable/gnome-color-manager/PKGBUILD gnome-unstable/gnome-contacts/PKGBUILD gnome-unstable/gnome-desktop/PKGBUILD gnome-unstable/gnome-keyring/PKGBUILD gnome-unstable/gnome-menus/PKGBUILD gnome-unstable/gnome-online-accounts/PKGBUILD gnome-unstable/gnome-panel/PKGBUILD gnome-unstable/gnome-power-manager/PKGBUILD gnome-unstable/gnome-screensaver/PKGBUILD gnome-unstable/gnome-session/PKGBUILD gnome-unstable/gnome-settings-daemon/PKGBUILD gnome-unstable/gnome-shell/PKGBUILD gnome-unstable/gnome-themes-standard/PKGBUILD gnome-unstable/gnome-utils/PKGBUILD gnome-unstable/gtk3/PKGBUILD gnome-unstable/gtkhtml4/PKGBUILD gnome-unstable/gtkmm3/PKGBUILD gnome-unstable/libgdata/PKGBUILD gnome-unstable/libgnome-keyring/PKGBUILD gnome-unstable/libsoup/PKGBUILD gnome-unstable/libwnck3/PKGBUILD gnome-unstable/mash/PKGBUILD gnome-unstable/mutter/PKGBUILD gnome-unstable/mx/PKGBUILD gnome-unstable/pulseaudio/PKGBUILD gnome-unstable/pygobject/PKGBUILD gnome-unstable/pygobject2/PKGBUILD gnome-unstable/seahorse/PKGBUILD gnome-unstable/sushi/PKGBUILD gnome-unstable/totem/PKGBUILD gnome-unstable/upower/PKGBUILD gnome-unstable/vala/PKGBUILD kde-unstable/kdebase-workspace/PKGBUILD multilib/lib32-glibc/PKGBUILD multilib/lib32-gtk/PKGBUILD multilib/lib32-libpng/PKGBUILD multilib/lib32-mpg123/PKGBUILD multilib/lib32-nspr/PKGBUILD multilib/lib32-nss/PKGBUILD multilib/lib32-nss/add_spi+cacert_ca_certs.patch multilib/lib32-openssl/PKGBUILD multilib/libtool-multilib/PKGBUILD multilib/wine/PKGBUILD testing/util-linux/PKGBUILD
Diffstat (limited to 'extra/dnsmasq')
-rw-r--r--extra/dnsmasq/PKGBUILD23
-rw-r--r--extra/dnsmasq/dnsmasq.confd9
-rw-r--r--extra/dnsmasq/dnsmasq.install21
-rw-r--r--extra/dnsmasq/dnsmasq.service13
-rwxr-xr-xextra/dnsmasq/rc.dnsmasq47
5 files changed, 90 insertions, 23 deletions
diff --git a/extra/dnsmasq/PKGBUILD b/extra/dnsmasq/PKGBUILD
index 388d61455..8e78bb04c 100644
--- a/extra/dnsmasq/PKGBUILD
+++ b/extra/dnsmasq/PKGBUILD
@@ -1,23 +1,28 @@
-# $Id: PKGBUILD 136349 2011-08-27 02:25:00Z dreisner $
+# $Id: PKGBUILD 137814 2011-09-11 16:06:30Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
# Contributor: Paul Mattal <paul@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
pkgname=dnsmasq
pkgver=2.58
-pkgrel=1
+pkgrel=2
pkgdesc="Lightweight, easy to configure DNS forwarder and DHCP server"
url="http://www.thekelleys.org.uk/dnsmasq/doc.html"
arch=('i686' 'x86_64' 'mips64el')
license=('GPL')
depends=('glibc' 'bash' 'dbus-core')
makedepends=('libcap>=2.16')
-backup=('etc/dnsmasq.conf')
-install=
-source=("http://www.thekelleys.org.uk/$pkgname/$pkgname-$pkgver.tar.gz"
- 'rc.dnsmasq')
+install=$pkgname.install
+backup=('etc/dnsmasq.conf'
+ 'etc/conf.d/dnsmasq')
+source=("http://www.thekelleys.org.uk/$pkgname/$pkgname-$pkgver.tar.gz"
+ 'dnsmasq.confd'
+ 'rc.dnsmasq'
+ 'dnsmasq.service')
md5sums=('14c5c81debb324adc261db971730f4c6'
- 'e956eee1ec24212a3254d2b168187495')
+ '66479e99123faeab83ebaed709ef95b5'
+ '818c122ea4d81868a75afad109411170'
+ 'f329d86f8ba1cd85f9b6ee59e0ce3791')
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -35,9 +40,11 @@ package() {
install -dm755 "$pkgdir"/var/{db,lib/misc}
install -Dm755 "$srcdir"/rc.dnsmasq "$pkgdir"/etc/rc.d/dnsmasq
+ install -Dm644 "$srcdir"/dnsmasq.confd "$pkgdir/etc/conf.d/dnsmasq"
+
install -Dm644 "dbus/dnsmasq.conf" "$pkgdir"/etc/dbus-1/system.d/dnsmasq.conf
install -Dm644 "dnsmasq.conf.example" "$pkgdir"/etc/dnsmasq.conf
- install -Dm644 "contrib/systemd/dnsmasq.service" "$pkgdir"/lib/systemd/system/dnsmasq.service
+ install -Dm644 "$srcdir/dnsmasq.service" "$pkgdir"/lib/systemd/system/dnsmasq.service
}
# vim: ts=2 sw=2 et ft=sh
diff --git a/extra/dnsmasq/dnsmasq.confd b/extra/dnsmasq/dnsmasq.confd
new file mode 100644
index 000000000..933b92850
--- /dev/null
+++ b/extra/dnsmasq/dnsmasq.confd
@@ -0,0 +1,9 @@
+#
+# runtime config for dnsmasq
+#
+
+# if unset, dnsmasq will run as nobody.
+DNSMASQ_USER=dnsmasq
+
+# other runtime options. treated as an array.
+DNSMASQ_OPTS=()
diff --git a/extra/dnsmasq/dnsmasq.install b/extra/dnsmasq/dnsmasq.install
new file mode 100644
index 000000000..c2edb7db5
--- /dev/null
+++ b/extra/dnsmasq/dnsmasq.install
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+add_dnsmasq_user() {
+ if ! getent passwd dnsmasq >/dev/null; then
+ useradd -r -d / -c 'dnsmasq daemon' -s /sbin/nologin dnsmasq
+ fi
+}
+
+post_install() {
+ add_dnsmasq_user
+}
+
+post_upgrade() {
+ add_dnsmasq_user
+}
+
+post_remove() {
+ if getent passwd dnsmasq >/dev/null; then
+ userdel dnsmasq
+ fi
+}
diff --git a/extra/dnsmasq/dnsmasq.service b/extra/dnsmasq/dnsmasq.service
new file mode 100644
index 000000000..b09cb24b9
--- /dev/null
+++ b/extra/dnsmasq/dnsmasq.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=A lightweight DHCP and caching DNS server
+
+[Service]
+Type=dbus
+BusName=uk.org.thekelleys.dnsmasq
+ExecStartPre=/usr/sbin/dnsmasq --test
+ExecStart=/usr/sbin/dnsmasq -k --enable-dbus --user=dnsmasq --pid-file
+ExecReload=/bin/kill -HUP $MAINPID
+
+[Install]
+WantedBy=multi-user.target
+Alias=dbus-uk.org.thekelleys.dnsmasq
diff --git a/extra/dnsmasq/rc.dnsmasq b/extra/dnsmasq/rc.dnsmasq
index 167607294..2ded33695 100755
--- a/extra/dnsmasq/rc.dnsmasq
+++ b/extra/dnsmasq/rc.dnsmasq
@@ -2,35 +2,52 @@
. /etc/rc.conf
. /etc/rc.d/functions
+. /etc/conf.d/dnsmasq
-PID=`pidof -o %PPID /usr/sbin/dnsmasq`
-case "$1" in
+pidfile=/run/dnsmasq.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
start)
stat_busy "Starting DNS/DHCP daemon"
- [ -z "$PID" ] && /usr/sbin/dnsmasq
- if [ $? -gt 0 ] ; then
- stat_fail
+ if [[ -z $PID ]] && /usr/sbin/dnsmasq --test &&
+ /usr/sbin/dnsmasq "--user=${DNSMASQ_USER:-nobody}" \
+ "--pid-file=$pidfile" \
+ "${DNSMASQ_OPTS[@]}"; then
+ add_daemon dnsmasq
+ stat_done
else
- add_daemon dnsmasq # create the 'state' dir
- stat_done
+ stat_fail
fi
;;
stop)
stat_busy "Stopping DNS/DHCP daemon"
- [ "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
- rm_daemon dnsmasq # remove the 'state' dir
+ if [[ $PID ]] && kill "$PID" &> /dev/null; then
+ # dnsmasq doesn't clean up after itself
+ rm -f "$pidfile"
+ rm_daemon dnsmasq
stat_done
+ else
+ stat_fail
fi
;;
restart)
$0 stop
- sleep 5
+ sleep 1
$0 start
;;
+ checkconfig)
+ # diagnostics will be printed, with zero/non-zero exit
+ /usr/sbin/dnsmasq --test
+ ;;
*)
- echo "usage: $0 {start|stop|restart}"
+ echo "usage: $0 <start|stop|restart|checkconfig>"
esac
-exit 0
+