summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <lack@gentoo.org>2010-07-28 15:05:23 +0000
committerJim Ramsay <lack@gentoo.org>2010-07-28 15:05:23 +0000
commit3145ce210eac6f20ccf9c7d9aa7a40f5cb45c86a (patch)
tree413661f94e6b35bdc1bd365dbdc31ca474108e4e /net-dns/openresolv
parentdon't die on +fftw -visualizer. fixes bug #330219 (diff)
downloadgentoo-2-3145ce210eac6f20ccf9c7d9aa7a40f5cb45c86a.tar.gz
gentoo-2-3145ce210eac6f20ccf9c7d9aa7a40f5cb45c86a.tar.bz2
gentoo-2-3145ce210eac6f20ccf9c7d9aa7a40f5cb45c86a.zip
Update pdnsd script for better posix compliance (Bug #248925)
(Portage version: 2.1.8.3/cvs/Linux x86_64)
Diffstat (limited to 'net-dns/openresolv')
-rw-r--r--net-dns/openresolv/ChangeLog8
-rw-r--r--net-dns/openresolv/files/pdnsd147
-rw-r--r--net-dns/openresolv/openresolv-3.3.4-r1.ebuild52
3 files changed, 141 insertions, 66 deletions
diff --git a/net-dns/openresolv/ChangeLog b/net-dns/openresolv/ChangeLog
index 699028444084..52d923ed51d8 100644
--- a/net-dns/openresolv/ChangeLog
+++ b/net-dns/openresolv/ChangeLog
@@ -1,6 +1,12 @@
# 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.58 2010/07/08 18:27:46 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/ChangeLog,v 1.59 2010/07/28 15:05:23 lack Exp $
+
+*openresolv-3.3.4-r1 (28 Jul 2010)
+
+ 28 Jul 2010; Jim Ramsay <lack@gentoo.org> +openresolv-3.3.4-r1.ebuild,
+ files/pdnsd:
+ Update pdnsd script for better posix compliance (Bug #248925)
08 Jul 2010; Raúl Porcel <armin76@gentoo.org> openresolv-3.3.4.ebuild:
alpha/arm/ia64/m68k/s390/sh/sparc stable wrt #323887
diff --git a/net-dns/openresolv/files/pdnsd b/net-dns/openresolv/files/pdnsd
index 473361e333b2..7a2d8601e4bc 100644
--- a/net-dns/openresolv/files/pdnsd
+++ b/net-dns/openresolv/files/pdnsd
@@ -1,5 +1,5 @@
-#!/bin/bash
-# Copyright 2006-2009 Gentoo Foundation
+#!/bin/sh
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# /etc/pdnsd/pdnsd.conf updater
@@ -85,7 +85,7 @@ PDNSDCONFIG="/etc/pdnsd/pdnsd.conf"
BACKUPSUFFIX=".backup"
# Load our variables from resolvconf
-eval "$(resolvconf -v)"
+eval "$(/sbin/resolvconf -v)"
COMMENT='
# Automatically generated by resolvconf.
@@ -148,18 +148,15 @@ 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; };
+@MATCH_LABELS@/^[[:space:]]*label[[:space:]]*=[[:space:]]*"resolvconf"/ { H; b adding; };
/^[[:space:]]*[\}]/ { H; x; p; d; };
H;
-b server_loop;
-'
+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@; };
-'
+'/^[[:space:]]*label[[:space:]]*=[[:space:]]*"@LABEL@"/ { H; x; b main_@RULE@; };'
###
# Editing one server. New lines are put into @SETUP@, lines are composed
@@ -180,12 +177,12 @@ n;
/^[[: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;
+/^[[:space:]]*exclude[[:space:]]*=/ b exclude_logic_@RULE@;
p;
/^[[:space:]]*[\}]/ d;
b loop_@RULE@;
-:exclude_logic_@RULE;
+:exclude_logic_@RULE@;
@EXCLUDE_LOGIC@
b loop_@RULE@;
'
@@ -242,7 +239,7 @@ uniqify() {
esac
shift
done
- echo "${result# *}"
+ printf "%s" "${result# *}"
}
###
@@ -250,23 +247,43 @@ uniqify() {
#
# Translate domain name into pdnsd's label
make_pdnsd_label() {
- local domain=$1
- if [[ -n ${domain} ]] ; then
- echo -n "resolvconf-${domain}"
+ local domain="$1"
+ if [ -n "${domain}" ] ; then
+ printf "%s" "resolvconf-${domain}"
else
- echo -n "resolvconf"
+ 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="${label//-/_}"
- label="${label//./_}"
- echo -n "${label}"
+ label="$(replace "${label}" "-" "_")"
+ label="$(replace "${label}" "." "_")"
+ printf "%s" "${label}"
}
# char *compose_lines(...)
@@ -275,9 +292,9 @@ make_sed_label() {
compose_lines() {
local line result
for line in "$@" ; do
- result="${result}i\\\\\\n${line// /\\t}\\n"
+ result="${result}i\\\\\\n$(replace "${line}" " " "\\t")\\n"
done
- echo "${result}"
+ printf "%s" "${result}"
}
###
@@ -310,18 +327,18 @@ compose_lines() {
#
build_settings() {
local ns="$1" domains="$2" directive="$3"
- if [[ -n ${ns} ]] ; then
+ 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
+ if [ -n "${domains}" ] ; then
for x in ${domains} ; do
list_domains="${list_domains},\".${x}.\""
done
list_domains="${list_domains#,}"
- if [[ $directive == "include" ]]; then
+ if [ x"$directive" = x"include" ]; then
compose_lines \
" preset=on;" \
" ip=${list_ns};" \
@@ -355,11 +372,11 @@ build_match_labels() {
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}"
+ new_match="$(replace "${SED_MATCH_ONE_LABEL}" "@LABEL@" "${label}")"
+ new_match="$(replace "${new_match}" "@RULE@" "${rule}")"
+ result="${result}${new_match}\n"
done
- echo "${result}"
+ printf "%s" "${result}"
}
###
@@ -374,18 +391,18 @@ build_domain_list_logic() {
# Domains should be pipe separated list
for x in ${domains}; do
x=".${x%.}"
- x="${x//./\.}"
+ x="$(replace "${x}" "." "\\.")"
domain_list="${domain_list}|${x}"
done
domain_list="${domain_list#|}"
- if [[ -z ${domain_list} ]]; then
+ if [ -z "${domain_list}" ]; then
logic="p;"
else
- logic="${SED_DOMAIN_LIST_LOGIC//@DOMAINS@/${domain_list}}"
- logic="${logic//@DIRECTIVE@/${directive}}"
+ logic="$(replace "${SED_DOMAIN_LIST_LOGIC}" "@DOMAINS@" "${domain_list}")"
+ logic="$(replace "${logic}" "@DIRECTIVE@" "${directive}")"
fi
- echo "${logic}"
+ printf "%s" "${logic}"
}
###
@@ -405,10 +422,10 @@ build_edit_part() {
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}"
+ result="$(replace "${SED_EDIT_ONE_SERVER}" "@SETUP@" "${setup}")"
+ result="$(replace "${result}" "@EXCLUDE_LOGIC@" "${logic}")"
+ result="$(replace "${result}" "@RULE@" "${rule}")"
+ printf "%s\n" "${result}"
}
###
@@ -422,12 +439,12 @@ get_domain_nameservers() {
local domain="$1" ns
shift
for x in "$@" ; do
- if [[ ${x%,*} == ${domain} ]] ; then
+ if [ x"${x%,*}" = x"${domain}" ] ; then
ns="${ns} ${x#*,}"
fi
done
ns="$(uniqify ${ns})"
- echo -n "${ns}"
+ printf "%s" "${ns}"
}
###
@@ -463,8 +480,8 @@ build_add_part() {
new_part="${new_part}$(compose_lines "}" "")"
add_part="${add_part}${new_part}"
done
- result="${SED_ADDING//@SETUP@/${add_part}}"
- echo "${result}"
+ result="$(replace "${SED_ADDING}" "@SETUP@" "${add_part}")"
+ printf "%s" "${result}"
}
###
@@ -494,10 +511,10 @@ build_sed_script() {
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}"
+ full="$(replace "${SED_LOOP}" "@MATCH_LABELS@" "${match_labels}")"
+ printf "%b\n" "${full}"
+ printf "%b\n" "${edit_changed}"
+ printf "%b" "${added}"
}
###
@@ -510,7 +527,7 @@ read_configured_domains() {
result="\
$(sed -nre 's/^[[:space:]]+label=\"?resolvconf-([^;\"]*)\";.*/\1/p' \
${config_file})"
- echo -n "${result}"
+ printf "%s" "${result}"
}
###
@@ -521,10 +538,10 @@ read_configured_domains() {
#
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}
+ 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
@@ -541,8 +558,8 @@ initialization() {
local config_file="$1"
# Compatibility fix for new openresolv-2.0
- if [[ -z ${NEWNS} && -n ${NAMESERVERS} ]]; then
- NEWDOMAIN=${DOMAINS//:/,}
+ if [ -z "${NEWNS}" -a -n "${NAMESERVERS}" ]; then
+ NEWDOMAIN=$(replace "${DOMAINS}" ":" ",")
NEWSEARCH=
NEWNS=${NAMESERVERS}
DOMAINS=
@@ -582,18 +599,18 @@ find_changed_and_added() {
# Find what has to be disabled
for x in ${configured} ; do
- if [[ " ${domains} " != *" ${x} "* ]] ; then
- CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}"
- fi
+ case " ${domains} " in
+ *" ${x} "*) ;;
+ *) CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}" ;;
+ esac
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
+ case " ${configured} " in
+ *" ${x} "*) CHANGE_DOMAINS="${CHANGE_DOMAINS} ${x}" ;;
+ *) ADD_DOMAINS="${ADD_DOMAINS} ${x}" ;;
+ esac
done
ADD_DOMAINS=$(uniqify ${ADD_DOMAINS})
@@ -611,17 +628,17 @@ make_configuration_change() {
local config_file="$1" backup_suffix="$2" sed_script="$3"
local old_config new_config
- old_config=$(< ${config_file})
+ old_config="$(cat "${config_file}")"
# Sanity check: add '}' at the end of the file
- new_config=$( (echo -n "${old_config}" && echo -ne "\n}" ) | \
+ new_config=$( (printf "%s" "${old_config}" && printf "\n}" ) | \
sed -nre "${sed_script}")
# Now remove what we added
new_config=${new_config%?\}}
- if [[ "${old_config}" != "${new_config}" ]] ; then
+ if [ x"${old_config}" != x"${new_config}" ] ; then
cp ${config_file} ${config_file}${backup_suffix}
- echo "${new_config}" > "${config_file}"
+ printf "%s\n" "${new_config}" > "${config_file}"
return 0
else
return 1
@@ -650,7 +667,7 @@ if make_configuration_change "${PDNSDCONFIG}" "${BACKUPSUFFIX}" "${sed_script}"
[ -e /var/cache/pdnsd/pdnsd.status ] || exit 0
# Reload config files
- /usr/sbin/pdnsd-ctl config &>/dev/null
+ /usr/sbin/pdnsd-ctl config >/dev/null 2>&1
fi
exit 0
diff --git a/net-dns/openresolv/openresolv-3.3.4-r1.ebuild b/net-dns/openresolv/openresolv-3.3.4-r1.ebuild
new file mode 100644
index 000000000000..1b6737999d4f
--- /dev/null
+++ b/net-dns/openresolv/openresolv-3.3.4-r1.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dns/openresolv/openresolv-3.3.4-r1.ebuild,v 1.1 2010/07/28 15:05:23 lack 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
+ !<net-dns/dnsmasq-2.40-r1"
+RDEPEND=""
+
+pkg_setup() {
+ export PREFIX=
+ export LIBEXECDIR="${PREFIX}/lib/resolvconf"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ exeinto /lib/resolvconf/
+ doexe "${FILESDIR}/pdnsd" || die
+}
+
+pkg_postinst() {
+ einfo "${PN}-3.0 has a new configuration file /etc/resolvconf.conf"
+ einfo "instead of mini files in different directories."
+ einfo "You should configure /etc/resolvconf.conf if you use a resolver"
+ einfo "other than libc."
+}
+
+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
+}