summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <lack@gentoo.org>2009-05-06 15:57:24 +0000
committerJim Ramsay <lack@gentoo.org>2009-05-06 15:57:24 +0000
commitadf1dc1e2c81d078a3f2e6fff7a23f818871c4e2 (patch)
tree329cba44ee857d0557af150ca4f58226cd56f4b4
parentCleanup (diff)
downloadhistorical-adf1dc1e2c81d078a3f2e6fff7a23f818871c4e2.tar.gz
historical-adf1dc1e2c81d078a3f2e6fff7a23f818871c4e2.tar.bz2
historical-adf1dc1e2c81d078a3f2e6fff7a23f818871c4e2.zip
Added script to support net-dns/pdnsd (Bug #248925)
Package-Manager: portage-2.2_rc27/cvs/Linux x86_64
-rw-r--r--net-dns/openresolv/ChangeLog9
-rw-r--r--net-dns/openresolv/Manifest14
-rw-r--r--net-dns/openresolv/files/pdnsd656
-rw-r--r--net-dns/openresolv/openresolv-2.0-r1.ebuild40
-rw-r--r--net-dns/openresolv/openresolv-2.0.1.ebuild4
-rw-r--r--net-dns/openresolv/openresolv-3.0.ebuild4
-rw-r--r--net-dns/openresolv/openresolv-3.1.1.ebuild4
-rw-r--r--net-dns/openresolv/openresolv-3.2.ebuild4
-rw-r--r--net-dns/openresolv/openresolv-3.3.2.ebuild4
9 files changed, 727 insertions, 12 deletions
diff --git a/net-dns/openresolv/ChangeLog b/net-dns/openresolv/ChangeLog
index 6540973b0100..3a0f1e4ffe3f 100644
--- a/net-dns/openresolv/ChangeLog
+++ b/net-dns/openresolv/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-dns/openresolv
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/ChangeLog,v 1.38 2009/05/04 01:40:58 lack Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/ChangeLog,v 1.39 2009/05/06 15:57:23 lack Exp $
+
+*openresolv-2.0-r1 (06 May 2009)
+
+ 06 May 2009; Jim Ramsay <lack@gentoo.org> +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 <lack@gentoo.org>
-files/openresolv-3.3-dnsmasq-dbus_pid.patch:
diff --git a/net-dns/openresolv/Manifest b/net-dns/openresolv/Manifest
index 83cfddb4f4df..e8cac68c1b55 100644
--- a/net-dns/openresolv/Manifest
+++ b/net-dns/openresolv/Manifest
@@ -1,14 +1,16 @@
+AUX pdnsd 18322 RMD160 6a49910f65ff18dafe573d26480c6e4d40eb7dc3 SHA1 a71ce938fc8b1aafb34a1099dfc825340bc44972 SHA256 52b947ddcd3bb1308c24d10d4a6deabca9474c758d5563e3e2547f9cbbc5847e
DIST openresolv-2.0.1.tar.bz2 8898 RMD160 69b052fca48e27ba62f95f6a3ab46cb146d4dc3c SHA1 38ff27a8e26405b20f3b242cf1c0315c9edc7c7b SHA256 97437dd7545554f7a2e101dffeea7501d69de58359dab54161f0838fc0dff7c5
DIST openresolv-2.0.tar.bz2 9211 RMD160 fdac1ae91c6ee5e36ae809570aae3d3310124b30 SHA1 91cbbcae79686ae2b661e8e2dcf461809e9e200e SHA256 6f32ce4ada191019188b2bdd1a6440052c25305ceb67b29833bd8d83da98adf9
DIST openresolv-3.0.tar.bz2 9156 RMD160 28caf8c8b561268336f6f42ff73f18d30df71719 SHA1 ed35f88680d5f104a560c28f675c4e747ee518b4 SHA256 e4f9e3511792a277f886a53698ffc5075c5d5e6e0687dc765f59975ad642859c
DIST openresolv-3.1.1.tar.bz2 9175 RMD160 d955fff8bcbf4687304d9e9a64c8240ad7328164 SHA1 62d887b34973ee2886803fb60988863b804ca66e SHA256 e8ce606cf0d89e688e3447f922f57c7e101e2f91dd80bbda15798f262e652bd6
DIST openresolv-3.2.tar.bz2 9392 RMD160 82aec03bde3c147fd7d83e54fe9a6990c8dac632 SHA1 375fa9e8cd3ee3bfca579d649e12fcfd0a4f0ccf SHA256 ae232f03ec729ac65f356fceb2d39377ae720cf0ee24223a2f8d1168bcd9f01a
DIST openresolv-3.3.2.tar.bz2 9485 RMD160 85d5678b5c4f591985ac9c00e7d0df456f52a1e7 SHA1 4a1a8c7127fe2dac44c6faedaca7ca2c2a2a4823 SHA256 f1996cddcaa9014455c225f93654eead9524416e882c3a08f44aa68c3fb5e9b1
-EBUILD openresolv-2.0.1.ebuild 1100 RMD160 1ad52c7b36151b496ffeba202711b2079c9e75c0 SHA1 7612592b189bd04d22a3c2630acd27fbefc4fb45 SHA256 b3b85798179c826bbf92f609de3be8c2dbdc29f9ee15901d48388c7c93b35e4a
+EBUILD openresolv-2.0-r1.ebuild 1160 RMD160 91928402f32df22b5d8a036ed8dd8d9b4d1a0bde SHA1 1ef84861d6927a0ccebaa90cb0e5be8d95342fa8 SHA256 c02fc8cd9d7d6e8d8cf9a7708a6a8017a7b6b504947e97c013e04da5328f1dd9
+EBUILD openresolv-2.0.1.ebuild 1159 RMD160 db03b256bad088a9eb0c20f08b25472a8907bed6 SHA1 0d6e59215cfc1c87f4d36cad644645e7b659cb55 SHA256 ea30168bdbe7e5a8665414027ac6d07e347df04b797cd8af308e41c0a4cf515d
EBUILD openresolv-2.0.ebuild 1085 RMD160 dbe79c87069109b96a10adbabc701e5e56c1c240 SHA1 d9a44561ff809f36fd0f267c4e7d695c5947d0b3 SHA256 2d1426247dbbe0c7f04086f842a233031385ad8a3ad7ea780f2959cfc8f656d7
-EBUILD openresolv-3.0.ebuild 1349 RMD160 4ba2d82b2668ad64517c6f9900047ef40b026d6e SHA1 5c3ba7ed22082d4c9272c320fa3b671ecd17e623 SHA256 5d4e3fb32411e9c7721b54cf93f3fc6f19ddabc37f8976b3e2cffb10dfe6aabd
-EBUILD openresolv-3.1.1.ebuild 1351 RMD160 6b2fe10fb7178ee52778fd97a0651ea17f61e41d SHA1 5702cdd8fbb996a64e9b7697ac60d42b36323bc4 SHA256 6f03f191170083885db6d9b42b9c4bc035f88304cd64226e9889e8c418d63e2c
-EBUILD openresolv-3.2.ebuild 1349 RMD160 443bf810521a389a2f0049340d532fe73f90e42a SHA1 885ed8c1e0335c8aad9f386ad610b73e9d6eb918 SHA256 4f450967f9c5a38b2c8f5ac514207276a24ef7d711412e96bf83119dec02912d
-EBUILD openresolv-3.3.2.ebuild 1401 RMD160 dd47d918b53500c039cee4b2938afa86fca4c8c6 SHA1 c3a9be55d9eb5a953b77d866eb9ab46c2122d23c SHA256 668db449a2d2d9137e55ac97415ddcb2835d54ce611e84bcaeb3e7a3b89de6ab
-MISC ChangeLog 4957 RMD160 62334e314b487c40af8c993de35ce3fca161c744 SHA1 42f2c77e1c840e19f2ec67a1952c01722bb19b56 SHA256 a563a27aebb8bdb13a8fa1a6e9470f02d8270b0ccefc8910630be4a91ecd0a51
+EBUILD openresolv-3.0.ebuild 1403 RMD160 147af7d334db35ae9ea8696b5da8176ddac298b6 SHA1 287c0b18e2e806cc2660d11593a8ebc539a457e1 SHA256 4c910175eaf62134000dc9c2abd52f2fe0b538f4697396ac46500a53a4e65563
+EBUILD openresolv-3.1.1.ebuild 1405 RMD160 245d81238fb8077e2ea142b4bfa3c40825e832e9 SHA1 e0ff174163fbb3b8ff3011fd704102d515928fad SHA256 d47b4e71706e0b7ccf77f2a691ac60258599ea2b72c80d9c775a7a49f01b7ed6
+EBUILD openresolv-3.2.ebuild 1403 RMD160 6e94d1cff925db08a6b2b118f700d6a961370a1a SHA1 1d700df2cefe588127126500c5627eab137ae3fb SHA256 b605aa22c56070aa8ef7de375ea18501d2dc9c29d6151c2fc43d4fa16db622bb
+EBUILD openresolv-3.3.2.ebuild 1454 RMD160 72bbceeff4b17793acc2aa18b8a6f7da24c4122e SHA1 e0969d2fdeeeb423f295791e5a2c04df59b812f4 SHA256 4baca0e1cce7b92747f42db5d88548fcb5be274ea70f0070ba3090ae9ca41d79
+MISC ChangeLog 5256 RMD160 c03cb41edf3d76df67336140dbf712f08befc91f SHA1 151118d7bfd560f714040eeb5fd2f0d7ced1411d SHA256 02ef6445238561b1bba68730aad767e079778d3626961edb03ad28d554bb9ae6
MISC metadata.xml 341 RMD160 3c913acf95bbe75c703c788af7aef99b76e1b6f3 SHA1 9441910f8e4a6cafccd4701c3daaf05b6be862d5 SHA256 beb1a30f85ba28709163805bb76e9bffaf10f85ab5a4bc59bb6d621c11e6c598
diff --git a/net-dns/openresolv/files/pdnsd b/net-dns/openresolv/files/pdnsd
new file mode 100644
index 000000000000..473361e333b2
--- /dev/null
+++ b/net-dns/openresolv/files/pdnsd
@@ -0,0 +1,656 @@
+#!/bin/bash
+# Copyright 2006-2009 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 ".<domain>" or ".<domain>." 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 <net-dns/openresolv-2.0, configure the lo interface to use
+# 127.0.0.1. In Gentoo we set it up like so in /etc/conf.d/net
+#
+# dns_servers_lo=( "127.0.0.1" )
+#
+# b) For net-dns/openresolv-2* the configuration has been changed. Add
+# the following line to the top of your /etc/resolvconf/resolv.conf.d/base
+# (possibly create one)
+#
+# nameserver 127.0.0.1
+#
+# c) For net-dns/openresolv-3* the configuration has been changed again.
+# Uncomment the following line in your /etc/resolvconf.conf
+#
+# # If you run a local name server, you should uncomment the below line and
+# # configure your subscribers configuration files below.
+# name_servers=127.0.0.1
+#
+
+# pdnsd config file
+PDNSDCONFIG="/etc/pdnsd/pdnsd.conf"
+
+# Backup suffix
+BACKUPSUFFIX=".backup"
+
+# Load our variables from resolvconf
+eval "$(resolvconf -v)"
+
+COMMENT='
+# Automatically generated by resolvconf.
+#
+# Following server sections are automatically enabled and disabled.
+#
+# !!! WARNING !!!
+# DO NOT RENAME LABELS!
+#
+# No section will be deleted and only some options are automatically changed.
+# Feel free to add your own options, but do not use pair comments /* */ as they
+# are not recognised.
+#
+# DO NOT USE resolvconf ANYWHERE IN YOUR LABELS!
+#
+# Automatically changed options are (with examples):
+# preset=on;
+# ip="192.168.0.1","192.168.0.2";
+# include=".net",".com";
+# exclude=".domain.net",".domain.com";
+# policy=excluded;
+#
+# The exclude directive is changed automatically only in "resolvconf" server
+# section. Not handled servers are kept in the directive.
+#'
+BASIC_SETTINGS='server {
+ label="resolvconf";
+ preset=off;
+}'
+
+INSTALLATION_CHECK='^[[:space:]]*label[[:space:]]*=[[:space:]]*"resolvconf"'
+
+###
+# Sed script configuration
+#
+# Composed sequence of lines:
+#
+# (1) SED_LOOP with @MATCH_LABELS@ substituted by several SED_MATCH_ONE_LABEL
+# (2) SED_EDIT_ONE_SERVER several times
+# (3) SED_ADDING with new servers
+#
+# Notes:
+#
+# * @LABEL@ is a string "resolvconf-<domain>" 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-<domain>) 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
+ echo "${result# *}"
+}
+
+###
+# char *make_pdnsd_label(char *domain)
+#
+# Translate domain name into pdnsd's label
+make_pdnsd_label() {
+ local domain=$1
+ if [[ -n ${domain} ]] ; then
+ echo -n "resolvconf-${domain}"
+ else
+ echo -n "resolvconf"
+ fi
+}
+
+###
+# char *make_sed_label(char *pdnsd_label)
+#
+# Translate pdnsd's label into sed's label
+make_sed_label() {
+ local label="$1"
+ label="${label//-/_}"
+ label="${label//./_}"
+ echo -n "${label}"
+}
+
+# char *compose_lines(...)
+#
+# Compose a sed command that prints lines
+compose_lines() {
+ local line result
+ for line in "$@" ; do
+ result="${result}i\\\\\\n${line// /\\t}\\n"
+ done
+ echo "${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 [[ $directive == "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="${SED_MATCH_ONE_LABEL//@LABEL@/${label}}"
+ new_match="${new_match//@RULE@/${rule}}"
+ result="${result}${new_match}"
+ done
+ echo "${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="${x//./\.}"
+ domain_list="${domain_list}|${x}"
+ done
+ domain_list="${domain_list#|}"
+
+ if [[ -z ${domain_list} ]]; then
+ logic="p;"
+ else
+ logic="${SED_DOMAIN_LIST_LOGIC//@DOMAINS@/${domain_list}}"
+ logic="${logic//@DIRECTIVE@/${directive}}"
+ fi
+ echo "${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="${SED_EDIT_ONE_SERVER//@SETUP@/${setup}}"
+ result="${result//@EXCLUDE_LOGIC@/${logic}}"
+ result="${result//@RULE@/${rule}}"
+ echo "${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 <domain>,<ip>.
+#
+get_domain_nameservers() {
+ local domain="$1" ns
+ shift
+ for x in "$@" ; do
+ if [[ ${x%,*} == ${domain} ]] ; then
+ ns="${ns} ${x#*,}"
+ fi
+ done
+ ns="$(uniqify ${ns})"
+ echo -n "${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 <domain>,<ip>.
+#
+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="${SED_ADDING//@SETUP@/${add_part}}"
+ echo "${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 <domain>,<ip>), 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="${SED_LOOP//@MATCH_LABELS@/${match_labels}}"
+ echo -ne "${full}"
+ echo -ne "${edit_changed}"
+ echo -ne "${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})"
+ echo -n "${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 ; then
+ echo -e "${COMMENT}" >> ${config_file}
+ echo -e "\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} && -n ${NAMESERVERS} ]]; then
+ NEWDOMAIN=${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
+ if [[ " ${domains} " != *" ${x} "* ]] ; then
+ CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}"
+ fi
+ done
+
+ # Find what has to be added
+ for x in ${domains} ; do
+ if [[ " ${configured} " != *" ${x} "* ]] ; then
+ ADD_DOMAINS="${ADD_DOMAINS} ${x}"
+ else
+ CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}"
+ fi
+ 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=$(< ${config_file})
+
+ # Sanity check: add '}' at the end of the file
+ new_config=$( (echo -n "${old_config}" && echo -ne "\n}" ) | \
+ sed -nre "${sed_script}")
+ # Now remove what we added
+ new_config=${new_config%?\}}
+
+ if [[ "${old_config}" != "${new_config}" ]] ; then
+ cp ${config_file} ${config_file}${backup_suffix}
+ echo "${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
+fi
+
+exit 0
diff --git a/net-dns/openresolv/openresolv-2.0-r1.ebuild b/net-dns/openresolv/openresolv-2.0-r1.ebuild
new file mode 100644
index 000000000000..1b4a907f1a43
--- /dev/null
+++ b/net-dns/openresolv/openresolv-2.0-r1.ebuild
@@ -0,0 +1,40 @@
+# 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-2.0-r1.ebuild,v 1.1 2009/05/06 15:57:23 lack Exp $
+
+inherit eutils
+
+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 ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND="!net-dns/resolvconf-gentoo
+ !<net-dns/dnsmasq-2.40-r1"
+RDEPEND=""
+
+src_install() {
+ emake DESTDIR="${D}" install || die "Failed to install"
+ exeinto /etc/resolvconf/update.d/
+ doexe "${FILESDIR}/pdnsd"
+}
+
+pkg_config() {
+ if [ "${ROOT}" != "/" ]; then
+ eerror "We cannot configure unless \$ROOT=/"
+ return 1
+ fi
+
+ if [ -n "$(resolvconf -l)" ]; then
+ einfo "${PN} already has DNS information"
+ else
+ ebegin "Copying /etc/resolv.conf to resolvconf -a dummy"
+ resolvconf -a dummy </etc/resolv.conf
+ eend $? || return $?
+ einfo "The dummy interface will disappear when you next reboot"
+ fi
+}
diff --git a/net-dns/openresolv/openresolv-2.0.1.ebuild b/net-dns/openresolv/openresolv-2.0.1.ebuild
index c05dd6769d7f..71f5320ee4ea 100644
--- a/net-dns/openresolv/openresolv-2.0.1.ebuild
+++ b/net-dns/openresolv/openresolv-2.0.1.ebuild
@@ -1,6 +1,6 @@
# 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-2.0.1.ebuild,v 1.1 2009/02/19 11:05:37 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-2.0.1.ebuild,v 1.2 2009/05/06 15:57:23 lack Exp $
inherit eutils
@@ -19,6 +19,8 @@ RDEPEND=""
src_install() {
emake DESTDIR="${D}" install || die "Failed to install"
+ exeinto /etc/resolvconf/update.d/
+ doexe "${FILESDIR}/pdnsd"
}
pkg_config() {
diff --git a/net-dns/openresolv/openresolv-3.0.ebuild b/net-dns/openresolv/openresolv-3.0.ebuild
index 2d4e675d9412..97df05cc7475 100644
--- a/net-dns/openresolv/openresolv-3.0.ebuild
+++ b/net-dns/openresolv/openresolv-3.0.ebuild
@@ -1,6 +1,6 @@
# 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.0.ebuild,v 1.1 2009/03/17 10:07:21 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.0.ebuild,v 1.2 2009/05/06 15:57:23 lack Exp $
inherit eutils
@@ -23,6 +23,8 @@ pkg_setup() {
src_install() {
emake DESTDIR="${D}" install
+ exeinto /libexec/resolvconf/
+ doexe "${FILESDIR}/pdnsd"
}
pkg_postinst() {
diff --git a/net-dns/openresolv/openresolv-3.1.1.ebuild b/net-dns/openresolv/openresolv-3.1.1.ebuild
index 090a21bb00e7..15d74bef6b88 100644
--- a/net-dns/openresolv/openresolv-3.1.1.ebuild
+++ b/net-dns/openresolv/openresolv-3.1.1.ebuild
@@ -1,6 +1,6 @@
# 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.1.1.ebuild,v 1.1 2009/03/19 10:46:21 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.1.1.ebuild,v 1.2 2009/05/06 15:57:23 lack Exp $
inherit eutils
@@ -23,6 +23,8 @@ pkg_setup() {
src_install() {
emake DESTDIR="${D}" install
+ exeinto /libexec/resolvconf/
+ doexe "${FILESDIR}/pdnsd"
}
pkg_postinst() {
diff --git a/net-dns/openresolv/openresolv-3.2.ebuild b/net-dns/openresolv/openresolv-3.2.ebuild
index 429e57bc90c5..79a48d8aba27 100644
--- a/net-dns/openresolv/openresolv-3.2.ebuild
+++ b/net-dns/openresolv/openresolv-3.2.ebuild
@@ -1,6 +1,6 @@
# 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.2.ebuild,v 1.1 2009/04/20 09:16:29 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.2.ebuild,v 1.2 2009/05/06 15:57:23 lack Exp $
inherit eutils
@@ -23,6 +23,8 @@ pkg_setup() {
src_install() {
emake DESTDIR="${D}" install
+ exeinto /libexec/resolvconf/
+ doexe "${FILESDIR}/pdnsd"
}
pkg_postinst() {
diff --git a/net-dns/openresolv/openresolv-3.3.2.ebuild b/net-dns/openresolv/openresolv-3.3.2.ebuild
index a7f550c52228..171cb006fd0b 100644
--- a/net-dns/openresolv/openresolv-3.3.2.ebuild
+++ b/net-dns/openresolv/openresolv-3.3.2.ebuild
@@ -1,6 +1,6 @@
# 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.1 2009/05/01 18:29:45 lack Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.3.2.ebuild,v 1.2 2009/05/06 15:57:23 lack Exp $
EAPI=2
inherit eutils
@@ -25,6 +25,8 @@ pkg_setup() {
src_install() {
emake DESTDIR="${D}" install
+ exeinto /lib/resolvconf/
+ doexe "${FILESDIR}/pdnsd"
}
pkg_postinst() {