From 5a80e9f28975b402b745b80c3deffb9d048dea59 Mon Sep 17 00:00:00 2001 From: Mike Hammill Date: Wed, 5 Jan 2011 19:22:46 +0100 Subject: Add all Gentoo standard openresolv ebuild files. As of 2011-1-5 at 19.23. --- net-dns/openresolv/ChangeLog | 250 ++++++++++ net-dns/openresolv/Manifest | 20 + net-dns/openresolv/files/pdnsd | 673 ++++++++++++++++++++++++++ net-dns/openresolv/metadata.xml | 15 + net-dns/openresolv/openresolv-3.3.2.ebuild | 52 ++ net-dns/openresolv/openresolv-3.3.4-r1.ebuild | 52 ++ net-dns/openresolv/openresolv-3.3.4.ebuild | 52 ++ net-dns/openresolv/openresolv-3.4.0.ebuild | 49 ++ 8 files changed, 1163 insertions(+) create mode 100644 net-dns/openresolv/ChangeLog create mode 100644 net-dns/openresolv/Manifest create mode 100644 net-dns/openresolv/files/pdnsd create mode 100644 net-dns/openresolv/metadata.xml create mode 100644 net-dns/openresolv/openresolv-3.3.2.ebuild create mode 100644 net-dns/openresolv/openresolv-3.3.4-r1.ebuild create mode 100644 net-dns/openresolv/openresolv-3.3.4.ebuild create mode 100644 net-dns/openresolv/openresolv-3.4.0.ebuild diff --git a/net-dns/openresolv/ChangeLog b/net-dns/openresolv/ChangeLog new file mode 100644 index 0000000..7c3bdc2 --- /dev/null +++ b/net-dns/openresolv/ChangeLog @@ -0,0 +1,250 @@ +# ChangeLog for net-dns/openresolv +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/ChangeLog,v 1.62 2010/12/18 17:33:17 mgorny Exp $ + +*openresolv-3.4.0 (18 Dec 2010) + + 18 Dec 2010; Michał Górny +openresolv-3.4.0.ebuild: + Version bump (on darkside's approval). The package now procides a configure + script and pdnsd support. Besides that, multilib libdir is now respected. + + 30 Sep 2010; Brent Baude openresolv-3.3.4.ebuild: + stable ppc64, bug 323887 + + 10 Aug 2010; Jeroen Roovers openresolv-3.3.4.ebuild: + Stable for HPPA (bug #323887). + +*openresolv-3.3.4-r1 (28 Jul 2010) + + 28 Jul 2010; Jim Ramsay +openresolv-3.3.4-r1.ebuild, + files/pdnsd: + Update pdnsd script for better posix compliance (Bug #248925) + + 08 Jul 2010; Raúl Porcel openresolv-3.3.4.ebuild: + alpha/arm/ia64/m68k/s390/sh/sparc stable wrt #323887 + + 27 Jun 2010; openresolv-3.3.4.ebuild: + ppc stable #323887 + + 24 Jun 2010; Pacho Ramos openresolv-3.3.4.ebuild: + stable amd64, bug 323887 + + 20 Jun 2010; Christian Faulhammer openresolv-3.3.4.ebuild: + stable x86, bug 323887 + +*openresolv-3.3.4 (09 Jan 2010) + + 09 Jan 2010; Jeremy Olexa -openresolv-2.0.ebuild, + -openresolv-2.0-r1.ebuild, -openresolv-2.0.1.ebuild, + -openresolv-3.0.ebuild, -openresolv-3.1.1.ebuild, -openresolv-3.2.ebuild, + +openresolv-3.3.4.ebuild, metadata.xml: + Version bump, fixes gentoo bug 295467. Remove old versions & add myself to + maintainer + + 28 Dec 2009; Raúl Porcel openresolv-3.3.2.ebuild: + alpha/ia64/m68k/s390/sh/sparc stable wrt #294510 + + 09 Dec 2009; nixnut openresolv-3.3.2.ebuild: + ppc stable #294510 + + 08 Dec 2009; Brent Baude openresolv-3.3.2.ebuild: + Marking openresolv-3.3.2 ppc64 for bug 294510 + + 03 Dec 2009; Jeroen Roovers openresolv-3.3.2.ebuild: + Stable for HPPA (bug #294510). + + 01 Dec 2009; Markus Meier openresolv-3.3.2.ebuild: + amd64/arm stable, bug #294510 + + 26 Nov 2009; Christian Faulhammer + openresolv-3.3.2.ebuild: + stable x86, bug 294510 + + 25 Nov 2009; Mike Frysinger openresolv-3.3.2.ebuild: + Add more die checks and remove unused eutils inherit. + + 28 May 2009; Raúl Porcel openresolv-3.1.1.ebuild: + alpha/arm/ia64/m68k/s390/sh/sparc stable wrt #268539 + + 27 May 2009; Jeroen Roovers openresolv-3.1.1.ebuild: + Stable for HPPA (bug #268539). + + 23 May 2009; Markus Meier openresolv-3.1.1.ebuild: + amd64 stable, bug #268539 + + 22 May 2009; Christian Faulhammer + openresolv-3.1.1.ebuild: + stable x86, bug 268539 + + 21 May 2009; Brent Baude openresolv-3.1.1.ebuild: + stable ppc, bug 268539 + + 19 May 2009; Brent Baude openresolv-3.1.1.ebuild: + stable ppc64, bug 268539 + +*openresolv-2.0-r1 (06 May 2009) + + 06 May 2009; Jim Ramsay +files/pdnsd, + +openresolv-2.0-r1.ebuild, openresolv-2.0.1.ebuild, openresolv-3.0.ebuild, + openresolv-3.1.1.ebuild, openresolv-3.2.ebuild, openresolv-3.3.2.ebuild: + Added script to support net-dns/pdnsd (Bug #248925) + + 01 May 2009; Jim Ramsay + -files/openresolv-3.3-dnsmasq-dbus_pid.patch: + Patch no longer needed (Part of 3.3.2) + +*openresolv-3.3.2 (01 May 2009) + + 01 May 2009; Jim Ramsay -openresolv-3.3-r1.ebuild, + +openresolv-3.3.2.ebuild, metadata.xml: + Version 3.3.2 is released, plus I'm taking over as maintainer + +*openresolv-3.3-r1 (30 Apr 2009) + + 30 Apr 2009; Jim Ramsay -openresolv-3.3.ebuild, + +openresolv-3.3-r1.ebuild, +files/openresolv-3.3-dnsmasq-dbus_pid.patch: + Fixed dbus detection bug for dnsmasq script + + 22 Apr 2009; Alexey Shvetsov openresolv-3.3: + Fix bug #263015 + +*openresolv-3.3 (22 Apr 2009) + + 22 Apr 2009; Raúl Porcel +openresolv-3.3.ebuild: + Version bump + +*openresolv-3.2 (20 Apr 2009) + + 20 Apr 2009; Raúl Porcel +openresolv-3.2.ebuild: + Version bump + +*openresolv-3.1.1 (19 Mar 2009) + + 19 Mar 2009; Raúl Porcel +openresolv-3.1.1.ebuild: + Version bump + +*openresolv-3.0 (17 Mar 2009) + + 17 Mar 2009; Raúl Porcel +openresolv-3.0.ebuild: + Version bump + +*openresolv-2.0.1 (19 Feb 2009) + + 19 Feb 2009; Raúl Porcel -openresolv-1.3.ebuild, + -openresolv-1.5.1.ebuild, -openresolv-1.7.1.ebuild, + -openresolv-1.8.ebuild, -openresolv-1.9.ebuild, +openresolv-2.0.1.ebuild: + Version bump + + 26 Nov 2008; Brent Baude openresolv-2.0.ebuild: + stable ppc64, bug 246537 + + 21 Nov 2008; Jeroen Roovers openresolv-2.0.ebuild: + Stable for HPPA (bug #246537). + + 16 Nov 2008; Markus Meier openresolv-2.0.ebuild: + amd64 stable, bug #246537 + + 15 Nov 2008; Tobias Scherbaum + openresolv-2.0.ebuild: + ppc stable, bug #246537 + + 14 Nov 2008; Raúl Porcel openresolv-2.0.ebuild: + alpha/arm/ia64/x86 stable wrt #246537 + + 12 Nov 2008; Ferris McCormick openresolv-2.0.ebuild: + Sparc stable and HOMEPAGE, SRC_URI updated, Bug #246537. + +*openresolv-2.0 (03 Oct 2008) + + 03 Oct 2008; Raúl Porcel +openresolv-2.0.ebuild: + Version bump + +*openresolv-1.9 (23 Sep 2008) + + 23 Sep 2008; Raúl Porcel +openresolv-1.9.ebuild: + Version bump + +*openresolv-1.8 (10 Sep 2008) + + 10 Sep 2008; Raúl Porcel -openresolv-1.1.ebuild, + -openresolv-1.5.ebuild, -openresolv-1.6.ebuild, -openresolv-1.7.ebuild, + +openresolv-1.8.ebuild: + Version bump + +*openresolv-1.7.1 (29 Aug 2008) + + 29 Aug 2008; Raúl Porcel +openresolv-1.7.1.ebuild: + Version bump + +*openresolv-1.7 (24 Aug 2008) + + 24 Aug 2008; Raúl Porcel +openresolv-1.7.ebuild: + Version bump + +*openresolv-1.6 (21 Aug 2008) + + 21 Aug 2008; Jesus Rivero +openresolv-1.6.ebuild: + Bump to 1.6 + + 14 Jun 2008; Christoph Mende openresolv-1.5.1.ebuild: + Stable on amd64, bug #224097 + + 13 Jun 2008; Tobias Klausmann + openresolv-1.5.1.ebuild: + Stable on alpha, bug #224097 + + 04 Jun 2008; Raúl Porcel openresolv-1.5.1.ebuild: + ia64/sparc stable wrt #224097 + + 04 Jun 2008; Markus Rothe openresolv-1.5.1.ebuild: + Stable on ppc/ppc64; bug #224097 + + 03 Jun 2008; Jeroen Roovers openresolv-1.5.1.ebuild: + Stable for HPPA (bug #224097). + + 02 Jun 2008; Christian Faulhammer + openresolv-1.5.1.ebuild: + stable x86, bug 224097 + +*openresolv-1.5.1 (09 Apr 2008) + + 09 Apr 2008; Peter Weller +openresolv-1.5.1.ebuild: + Bump to 1.5.1 + +*openresolv-1.5 (29 Mar 2008) + + 29 Mar 2008; Mike Frysinger +openresolv-1.5.ebuild: + Version bump. + + 27 Mar 2008; Jeroen Roovers openresolv-1.3.ebuild: + Stable for HPPA (bug #214226). + + 22 Mar 2008; Brent Baude openresolv-1.3.ebuild: + stable ppc64, bug 214226 + + 22 Mar 2008; Raúl Porcel openresolv-1.3.ebuild: + ia64/sparc stable wrt #214226 + + 22 Mar 2008; nixnut openresolv-1.3.ebuild: + Stable on ppc wrt bug 214226 + + 22 Mar 2008; Tobias Klausmann openresolv-1.3.ebuild: + Stable on alpha, bug #214226 + + 22 Mar 2008; Christian Faulhammer + openresolv-1.3.ebuild: + stable x86, bug 214226 + + 20 Feb 2008; openresolv-1.3.ebuild: + Patch it properly this time... Bug 209423 + +*openresolv-1.3 (18 Feb 2008) + + 18 Feb 2008; +openresolv-1.3.ebuild: + Bump to 1.3, Fix deps. Bug 209423 + +*openresolv-1.1 (31 Dec 2007) + + 31 Dec 2007; +metadata.xml, +openresolv-1.1.ebuild: + Initial import; bug 201853 + diff --git a/net-dns/openresolv/Manifest b/net-dns/openresolv/Manifest new file mode 100644 index 0000000..cfe7b4e --- /dev/null +++ b/net-dns/openresolv/Manifest @@ -0,0 +1,20 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA1 + +AUX pdnsd 19161 RMD160 6cd5e5202f24d6102b38f37bfc5a8d665cf99962 SHA1 83bfb3589ed542a6cf1c0d41ca0c563220095127 SHA256 a012a090e551c4a73ea0caf801dee2e4b467cb28aaff465890a002f8529e16ed +DIST openresolv-3.3.2.tar.bz2 9485 RMD160 85d5678b5c4f591985ac9c00e7d0df456f52a1e7 SHA1 4a1a8c7127fe2dac44c6faedaca7ca2c2a2a4823 SHA256 f1996cddcaa9014455c225f93654eead9524416e882c3a08f44aa68c3fb5e9b1 +DIST openresolv-3.3.4.tar.bz2 10495 RMD160 d87fdae8426b928fdf414cd335cbf0c2f70df9d1 SHA1 99532b1cb34922d139a827437f23cf9a0e843776 SHA256 8288e436c67e0f85bdda25916f6daba78009af353529944eb9fa6cdeb5c38e48 +DIST openresolv-3.4.0.tar.bz2 12740 RMD160 4ac15ec009f1bcc8ebcd7de12a3504be017e24df SHA1 73324909f3984bc4f20167809beee4c391575b9e SHA256 f1429830bd51ab74f5aa5c6367131c720d3ac990b80198f2bb6f6b24b85cd73c +EBUILD openresolv-3.3.2.ebuild 1444 RMD160 4f735fe8c6961be0c8aa327192bcf03f6259535b SHA1 5f064a758b543f83cfad3e59751fa3eff1d3b831 SHA256 9557df0ab4361606d00a76ed4ee88120e44f1506687e857af4f37ce34c3e1b89 +EBUILD openresolv-3.3.4-r1.ebuild 1456 RMD160 c4424a56abea47363b178be17045e101dd31df8d SHA1 cf8093417d332ca51bdc7c876ab34d8712bd9ae4 SHA256 79dbf4f3a9c8c606fcbb0136c96ecc3faace9b9a66b50b8afa9b68f2f66b000b +EBUILD openresolv-3.3.4.ebuild 1443 RMD160 d3b12af4d096b21bd5461c90d9fc5665052bd7de SHA1 bdd4b50f63cf8ca1b8fec71dc0d7ad101aac9db0 SHA256 b92146dddb8a959e6f0a6ac25df4bf7eee4653ff19ecfb672c8f050599311bc0 +EBUILD openresolv-3.4.0.ebuild 1357 RMD160 0a65dfbf5984f090aa906af4b0a1b161b16ac05f SHA1 faf31bae6606338f3035d465b7c24847aed86f0d SHA256 7f608ead9e45e73bfcfd610a9eb2e23c52fea06dcacc52ecb0cc8ea56cab95e5 +MISC ChangeLog 8137 RMD160 c059a35b04b649edfd39c175eb37ff49dec24636 SHA1 d63df05405086e8b830f62adb93829bb17133e44 SHA256 b47e70d8129ba16a1485ef2de278310df476c86a1a934d1642749a6237fd1ef2 +MISC metadata.xml 407 RMD160 bc0655eb7762cddca121e3e2d75878723be9d751 SHA1 cd1f19d5ad1161f1fc701e0fc755e4165f49bc5b SHA256 4526608e180ccadf270ea13601c244268e3d9dff940c2d303ec63ffa30474861 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.16 (GNU/Linux) + +iEYEARECAAYFAk0M78EACgkQnGSe5QXeB7s+QACgmMLrqDUNzgqztrWcPAyrzLq0 +k4IAmQG0YXGfEQ34EBusXFhWQnXiWq25 +=916U +-----END PGP SIGNATURE----- diff --git a/net-dns/openresolv/files/pdnsd b/net-dns/openresolv/files/pdnsd new file mode 100644 index 0000000..7a2d860 --- /dev/null +++ b/net-dns/openresolv/files/pdnsd @@ -0,0 +1,673 @@ +#!/bin/sh +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# /etc/pdnsd/pdnsd.conf updater +# Written by Oldrich Jedlicka (oldium.pro@seznam.cz) + +# Implementation notes: +# * The assumptions are same as for other scripts like bind and dnsmasq: +# - We assume that we are a local dns cache - after all, why would a server +# use resolvconf? +# - Now that we have assumed this, we also assume that generic DHCP clients +# will enter their domains and search domains ONLY in the "search" field +# in their resolv.confs and VPN clients will put the domain they are for +# into the domain field only. +# - This allows pdnsd to forward domains for a specific VPN domain to the +# VPN nameserver and everything else to the standard name servers. +# +# HOW-TO CONFIGURE: +# +# To get this working, you need to do only two steps +# +# 1. Create a basic configuration of /etc/pdnsd/pdnsd.conf, you can use +# /etc/pdnsd/pdnsd.conf.example to start. +# +# Additional configuration will be created automatically be resolvconf. +# The generated server sections has labels starting with "resolvconf", so +# +# DO NOT USE "resolvconf" IN YOUR LABELS! +# +# Check if the status_ctl is set to "on", otherwise the configuration +# will not be automatically reloaded - see sample config file. +# +# You are free to edit automatically created server sections, but always +# write one option per line. There are few options that are always recreated +# and your changes in them will be lost. Here is the list (with example +# values): +# +# preset=on; +# ip="192.168.0.1","192.168.0.2"; +# include=".net",".com";' +# +# The exclude directive in "resolvconf" server section is partly recreated. +# Known (configured) domains in the form "." or ".." are +# added and removed automatically, unknown domains (also those not in +# the format above) found in this directive are kept. +# +# The sample configuration file /etc/pdnsd/pdnsd.conf prepared to work +# with resolvconf would look like this: +# +#global { +# perm_cache=2048; +# run_as="pdnsd"; +# status_ctl = on; # Important to enable status control +# run_ipv4=on; +# par_queries=2; # How many servers are probed in parallel +# interface = "lo"; # Interface on which the pdnsd listens +#} +# +# 2. The last step is to configure dns configuration for /etc/resolv.conf. +# +# a) For " or "resolvconf" for global +# section +# * @RULE@ is @LABEL@ with translated characters '-' and '.' into '_'. +### + +### +# Main loop with label match - it will redirect the processing to +# SED_EDIT_ONE_SERVER, when the label match is found. Special match is +# for "resolvconf" label - the control flow is redirected to SED_ADDING to +# allow adding new sections. +# +# To summarize: Old sections are edited as they appear in the file and new +# sections are added before the "resolvconf" section. +SED_LOOP=\ +'/^[[:space:]]*server[[:space:]]*[\{]/ b server; +p; d; +:server; h; +:server_loop; n; +/^[[:space:]]*server[[:space:]]*[\{]/ { x; p; b server_loop; }; +@MATCH_LABELS@/^[[:space:]]*label[[:space:]]*=[[:space:]]*"resolvconf"/ { H; b adding; }; +/^[[:space:]]*[\}]/ { H; x; p; d; }; +H; +b server_loop;' + +### +# Match for one label with a jump to SED_EDIT_ONE_SERVER +SED_MATCH_ONE_LABEL=\ +'/^[[:space:]]*label[[:space:]]*=[[:space:]]*"@LABEL@"/ { H; x; b main_@RULE@; };' + +### +# Editing one server. New lines are put into @SETUP@, lines are composed +# in function compose_lines(). After the new lines are added, all "preset", +# "ip" and "include" options are removed (not printed). +# +# Sanity checks: Check if there is a second label or another server directive. +# In both cases, there is some error in the file, so go to the beginning by +# jumping to SED_LOOP's :server. +SED_EDIT_ONE_SERVER=\ +':main_@RULE@; +p; @SETUP@ +:loop_@RULE@; +n; +/^[[:space:]]*server[[:space:]]*[\{]/ b server; +/^[[:space:]]*label[[:space:]]*=/ b server; +/^[[:space:]]*preset[[:space:]]*=/ b loop_@RULE@; +/^[[:space:]]*ip[[:space:]]*=/ b loop_@RULE@; +/^[[:space:]]*include[[:space:]]*=/ b loop_@RULE@; +/^[[:space:]]*policy[[:space:]]*=/ b loop_@RULE@; +/^[[:space:]]*exclude[[:space:]]*=/ b exclude_logic_@RULE@; +p; +/^[[:space:]]*[\}]/ d; +b loop_@RULE@; + +:exclude_logic_@RULE@; +@EXCLUDE_LOGIC@ +b loop_@RULE@; +' + +### +# Add new servers. All lines composed by function compose_lines() are put into +# @SETUP@. Then the control flow is returned to one special SED_EDIT_ONE_SERVER +# section with label "resolvconf". +SED_ADDING=\ +':adding; +@SETUP@ +x; b main_resolvconf; +' + + +### +# Edit the domain list (include/exclude). All empty fields and matching domains +# are removed. Unmaintained domains (not in resolvconf-) are kept. All +# domains should be in a pipe (|) separated list and should begin, but not end +# with a dot. The list is put into @DOMAINS@. The control flow continues, where +# it ended in SED_EDIT_ONE_SERVER. +# +SED_DOMAIN_LIST_LOGIC=\ +'h; +s/^([[:space:]]*@DIRECTIVE@[[:space:]]*=[[:space:]]*).*/\\1/; +x; +s/^[[:space:]]*@DIRECTIVE@[[:space:]]*=[[:space:]]*//; + +:@DIRECTIVE@_loop_@RULE@; +/([[:space:]]*("[^"]"*|[^,;]*)[[:space:]]*,)*[[:space:]]*("(@DOMAINS@|)\.?"|(@DOMAINS@)\.?|,)[[:space:]]*[,;]/ { + s/(([[:space:]]*("[^"]"*|[^,;]*)[[:space:]]*,)*[[:space:]]*)("(@DOMAINS@|)\.?"|(@DOMAINS@)\.?|,)[[:space:]]*([,;])/\\1\\7/; + b @DIRECTIVE@_loop_@RULE@; +}; + +s/^[,;]//g; +/^[[:space:]]*$/ b @DIRECTIVE@_end_@RULE@; +H; x; s/\\n//; p; +:@DIRECTIVE@_end_@RULE@; +' + +################################################################################ +# Functions + +### +# char* [] uniqify(char* list[]) +# +# Uniqify the items in the list +uniqify() { + local result= + while [ -n "$1" ] ; do + case " ${result} " in + *" $1 "*) ;; + *) result="${result} $1" ;; + esac + shift + done + printf "%s" "${result# *}" +} + +### +# char *make_pdnsd_label(char *domain) +# +# Translate domain name into pdnsd's label +make_pdnsd_label() { + local domain="$1" + if [ -n "${domain}" ] ; then + printf "%s" "resolvconf-${domain}" + else + printf "%s" "resolvconf" + fi +} + + +### +# char *replace(char *text, char *search, char *replace) +# +# Replaces all the found "search" occurences in the "text" with the "replace". +replace() { + local text="$1" search="$2" replace="$3" + local pre post="${text}" result="" + while [ x"${pre}" != x"${text}" ] ; do + post="${text}" + pre="${text%%$search*}" + post="${text#*$search}" + if [ x"${pre}" != x"${text}" ] ; then + result="${result}${pre}${replace}" + text="${post}" + fi + done + printf "%s" "${result}${post}" +} + +### +# char *make_sed_label(char *pdnsd_label) +# +# Translate pdnsd's label into sed's label +make_sed_label() { + local label="$1" + label="$(replace "${label}" "-" "_")" + label="$(replace "${label}" "." "_")" + printf "%s" "${label}" +} + +# char *compose_lines(...) +# +# Compose a sed command that prints lines +compose_lines() { + local line result + for line in "$@" ; do + result="${result}i\\\\\\n$(replace "${line}" " " "\\t")\\n" + done + printf "%s" "${result}" +} + +### +# char *build_settings(char *nameservers, char *domains, char *directive) +# +# Builds configuration part @SETUP@ of sed script. The directive parameter denotes +# if the domains are to be included ("include") or excluded ("exclude"). This +# involves options like +# +# (1) # [nameserver list is empty] +# preset=off; +# +# (2) # [domain list is empty] +# preset=on; +# ip="address","address"...; +# +# (3) # [directive=="include"] +# preset=on; +# ip="address","address"...; +# include=".domain.",".domain."...; +# policy=excluded; +# +# (4) # [directive=="exclude"] +# preset=on; +# ip="address","address"...; +# exclude=".domain.",".domain."...; +# policy=included; +# +# Note: Currently there will always be only one domain in "include" directive. +# +build_settings() { + local ns="$1" domains="$2" directive="$3" + if [ -n "${ns}" ] ; then + local x list_ns list_domains + for x in ${ns} ; do + list_ns="${list_ns},\"${x}\"" + done + list_ns="${list_ns#,}" + if [ -n "${domains}" ] ; then + for x in ${domains} ; do + list_domains="${list_domains},\".${x}.\"" + done + list_domains="${list_domains#,}" + if [ x"$directive" = x"include" ]; then + compose_lines \ + " preset=on;" \ + " ip=${list_ns};" \ + " include=${list_domains};" \ + " policy=excluded;" + else + compose_lines \ + " preset=on;" \ + " ip=${list_ns};" \ + " exclude=${list_domains};" \ + " policy=included;" + fi + else + compose_lines \ + " preset=on;" \ + " ip=${list_ns};" + fi + else + compose_lines \ + " preset=off;" + fi +} + +### +# char *build_match_labels(char *domains...) +# +# Build the label match part of the sed script +# +build_match_labels() { + local domain result label destination new_match + for domain in "$@" ; do + label="$(make_pdnsd_label "${domain}")" + rule="$(make_sed_label "${label}")" + new_match="$(replace "${SED_MATCH_ONE_LABEL}" "@LABEL@" "${label}")" + new_match="$(replace "${new_match}" "@RULE@" "${rule}")" + result="${result}${new_match}\n" + done + printf "%s" "${result}" +} + +### +# char *build_domain_list_logic(char *domains, char *directive) +# +# Build a logic for changing (removing) domains from a directive. +# +build_domain_list_logic() { + local domains="$1" directive="$2" + local x domain_list logic + + # Domains should be pipe separated list + for x in ${domains}; do + x=".${x%.}" + x="$(replace "${x}" "." "\\.")" + domain_list="${domain_list}|${x}" + done + domain_list="${domain_list#|}" + + if [ -z "${domain_list}" ]; then + logic="p;" + else + logic="$(replace "${SED_DOMAIN_LIST_LOGIC}" "@DOMAINS@" "${domain_list}")" + logic="$(replace "${logic}" "@DIRECTIVE@" "${directive}")" + fi + printf "%s" "${logic}" +} + +### +# char *build_edit_part(char *domain, char *nameservers, \ +# char *add_domains, char *remove_domains, +# char *directive) +# +# Build edit part of the sed script for a particular domain. Domain can be +# empty in the case it is the "resolvconf" server part. +# +build_edit_part() { + local domain="$1" nameservers="$2" add_domains="$3" remove_domains="$4" + local directive="$5" + local setup label rule logic result + + setup="$(build_settings "${nameservers}" "${add_domains}" "${directive}")" + label="$(make_pdnsd_label "${domain}")" + rule="$(make_sed_label "${label}")" + logic="$(build_domain_list_logic "${remove_domains}" "${directive}")" + result="$(replace "${SED_EDIT_ONE_SERVER}" "@SETUP@" "${setup}")" + result="$(replace "${result}" "@EXCLUDE_LOGIC@" "${logic}")" + result="$(replace "${result}" "@RULE@" "${rule}")" + printf "%s\n" "${result}" +} + +### +# char *get_domain_nameservers(char *domain, char *domain_config...) +# +# Get the list of nameservers belonging to one particular domain. +# +# Domain configuration is a space separated list of pair ,. +# +get_domain_nameservers() { + local domain="$1" ns + shift + for x in "$@" ; do + if [ x"${x%,*}" = x"${domain}" ] ; then + ns="${ns} ${x#*,}" + fi + done + ns="$(uniqify ${ns})" + printf "%s" "${ns}" +} + +### +# char *build_domain_edit_part(char *domain, char *domain_config...) +# +# Parse the list of domain configurations and build settings for one particular +# domain for the sed script. +# +# Domain configuration is a space separated list of pair ,. +# +build_domain_edit_part() { + local domain="$1" ns + shift + ns="$(get_domain_nameservers "${domain}" "$@")" + build_edit_part "${domain}" "${ns}" "${domain}" "" "include" +} + +### +# char *build_add_part(char *add, char *domains...) +# +# Build add part of the sed script for all domains that needs to be added +# +build_add_part() { + local add="$1" x label rule add_part new_part result + shift + for x in ${add} ; do + local domain="${x}" ns + ns="$(get_domain_nameservers "${domain}" "$@")" + label="$(make_pdnsd_label "${domain}")" + rule="$(make_sed_label ${label})" + new_part="$(compose_lines "server {" " label=\"${label}\";")" + new_part="${new_part}$(build_settings "${ns}" "${domain}" "include")" + new_part="${new_part}$(compose_lines "}" "")" + add_part="${add_part}${new_part}" + done + result="$(replace "${SED_ADDING}" "@SETUP@" "${add_part}")" + printf "%s" "${result}" +} + +### +# char *build_sed_script(char *nameservers, char *domain_config, +# char *change, char *add, +# char *active_domains, char *known_domains) +# +# Build the full sed script from the list of nameservers, list of domains +# (in format ,), list of changed domains, list of added domains, +# list of activly used domains and a list of all known domains. +# +build_sed_script() { + local ns="$1" domain_config="$2" change="$3" add="$4" + local active_domains="$5" known_domains="$6" + + local match_labels="$(build_match_labels ${change})" + + local edit_changed x + for x in ${change} ; do + edit_changed="${edit_changed}$( \ + build_domain_edit_part "${x}" ${domain_config})" + done + edit_changed="${edit_changed}$( \ + build_edit_part "" "${ns}" "${active_domains}" "${known_domains}" "exclude")" + + local added + added="$(build_add_part "${add}" ${domain_config})" + + local full + full="$(replace "${SED_LOOP}" "@MATCH_LABELS@" "${match_labels}")" + printf "%b\n" "${full}" + printf "%b\n" "${edit_changed}" + printf "%b" "${added}" +} + +### +# char *read_configured_domains(char *config_file) +# +# Reads labels of servers starting with resolvconf* from the configuration file. +# +read_configured_domains() { + local config_file="$1" result + result="\ + $(sed -nre 's/^[[:space:]]+label=\"?resolvconf-([^;\"]*)\";.*/\1/p' \ + ${config_file})" + printf "%s" "${result}" +} + +### +# void installation_check(char *config_file) +# +# Check if the pdnsd is installed and can be configured. Prepare also the file +# for resolvconf. +# +installation_check() { + local config_file="$1" + if [ -e "${config_file}" ] ; then + if ! grep ${INSTALLATION_CHECK} "${config_file}" >/dev/null 2>&1; then + printf "%s\n" "${COMMENT}" >> "${config_file}" + printf "\n%s\n" "${BASIC_SETTINGS}" >> "${config_file}" + fi + return 0 + else + return 1 + fi +} + +### +# void initialization(char *config_file) +# +# Setup basic variables NAMESERVERS, DOMAINS an CONFIGURED_DOMAINS +# +initialization() { + local config_file="$1" + + # Compatibility fix for new openresolv-2.0 + if [ -z "${NEWNS}" -a -n "${NAMESERVERS}" ]; then + NEWDOMAIN=$(replace "${DOMAINS}" ":" ",") + NEWSEARCH= + NEWNS=${NAMESERVERS} + DOMAINS= + NAMESERVERS= + SEARCH= + fi + + for N in ${NEWNS} ; do + NAMESERVERS="${NAMESERVERS} ${N}" + done + + for N in ${NEWSEARCH} ; do + NAMESERVERS="${NAMESERVERS} ${N#*,}" + done + + for DN in ${NEWDOMAIN} ; do + DOMAINS="${DOMAINS} ${DN%%,*}" + done + + CONFIGURED_DOMAINS=$(read_configured_domains ${config_file}) + + NAMESERVERS=$(uniqify ${NAMESERVERS}) + DOMAINS=$(uniqify ${DOMAINS}) + CONFIGURED_DOMAINS=$(uniqify ${CONFIGURED_DOMAINS}) +} + +### +# void find_changed_and_added(char *configured, char *domains) +# +# Find already configured and newly added domains. Sets variables +# CHANGE_DOMAINS, ADD_DOMAINS and KNOWN_DOMAINS. +# +find_changed_and_added() { + local configured="$1" domains="$2" x + + KNOWN_DOMAINS="${CONFIGURED_DOMAINS} ${DOMAINS}" + + # Find what has to be disabled + for x in ${configured} ; do + case " ${domains} " in + *" ${x} "*) ;; + *) CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}" ;; + esac + done + + # Find what has to be added + for x in ${domains} ; do + case " ${configured} " in + *" ${x} "*) CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}" ;; + *) ADD_DOMAINS="${ADD_DOMAINS} ${x}" ;; + esac + done + + ADD_DOMAINS=$(uniqify ${ADD_DOMAINS}) + CHANGE_DOMAINS=$(uniqify ${CHANGE_DOMAINS}) + KNOWN_DOMAINS=$(uniqify ${KNOWN_DOMAINS}) +} + +### +# bool make_configuration_change(char *config_file, char *backup_suffix, +# char *sed_script) +# +# Applies any configuration change. Returns true, if there was a change. +# +make_configuration_change() { + local config_file="$1" backup_suffix="$2" sed_script="$3" + local old_config new_config + + old_config="$(cat "${config_file}")" + + # Sanity check: add '}' at the end of the file + new_config=$( (printf "%s" "${old_config}" && printf "\n}" ) | \ + sed -nre "${sed_script}") + # Now remove what we added + new_config=${new_config%?\}} + + if [ x"${old_config}" != x"${new_config}" ] ; then + cp ${config_file} ${config_file}${backup_suffix} + printf "%s\n" "${new_config}" > "${config_file}" + return 0 + else + return 1 + fi +} + +################################################################################ +# Main part + +# Check, if pdnsd configuration file is installed and possibly prepare it +installation_check "${PDNSDCONFIG}" || exit 0 + +# Basic initialization of NAMESERVERS, DOMAINS and CONFIGURED_DOMAINS +initialization "${PDNSDCONFIG}" + +find_changed_and_added "${CONFIGURED_DOMAINS}" "${DOMAINS}" + +sed_script="$(build_sed_script "${NAMESERVERS}" "${NEWDOMAIN}" \ + "${CHANGE_DOMAINS}" "${ADD_DOMAINS}" \ + "${DOMAINS}" "${KNOWN_DOMAINS}")" + +# Check if the config changed +if make_configuration_change "${PDNSDCONFIG}" "${BACKUPSUFFIX}" "${sed_script}" ; then + # Checks for running pdnsd + [ -x /usr/sbin/pdnsd-ctl ] || exit 0 + [ -e /var/cache/pdnsd/pdnsd.status ] || exit 0 + + # Reload config files + /usr/sbin/pdnsd-ctl config >/dev/null 2>&1 +fi + +exit 0 diff --git a/net-dns/openresolv/metadata.xml b/net-dns/openresolv/metadata.xml new file mode 100644 index 0000000..517968d --- /dev/null +++ b/net-dns/openresolv/metadata.xml @@ -0,0 +1,15 @@ + + + + no-herd + + lack@gentoo.org + Jim Ramsay + + + darkside@gentoo.org + + + A framework for managing DNS information + + diff --git a/net-dns/openresolv/openresolv-3.3.2.ebuild b/net-dns/openresolv/openresolv-3.3.2.ebuild new file mode 100644 index 0000000..be81dd9 --- /dev/null +++ b/net-dns/openresolv/openresolv-3.3.2.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.3.2.ebuild,v 1.9 2009/12/28 18:34:57 armin76 Exp $ + +EAPI=2 + +DESCRIPTION="A framework for managing DNS information" +HOMEPAGE="http://roy.marples.name/projects/openresolv" +SRC_URI="http://roy.marples.name/downloads/${PN}/${P}.tar.bz2" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd" +IUSE="" + +DEPEND="!net-dns/resolvconf-gentoo + !