diff options
author | Jim Ramsay <lack@gentoo.org> | 2010-07-28 15:05:23 +0000 |
---|---|---|
committer | Jim Ramsay <lack@gentoo.org> | 2010-07-28 15:05:23 +0000 |
commit | 6a97314dbe6064d886d0c222408bc6bdba437565 (patch) | |
tree | aa579d07a9939789172bcbafa1ba4f57eb7f609b /net-dns | |
parent | don't die on +fftw -visualizer. fixes bug #330219 (diff) | |
download | historical-6a97314dbe6064d886d0c222408bc6bdba437565.tar.gz historical-6a97314dbe6064d886d0c222408bc6bdba437565.tar.bz2 historical-6a97314dbe6064d886d0c222408bc6bdba437565.zip |
Update pdnsd script for better posix compliance (Bug #248925)
Package-Manager: portage-2.1.8.3/cvs/Linux x86_64
Diffstat (limited to 'net-dns')
-rw-r--r-- | net-dns/openresolv/ChangeLog | 8 | ||||
-rw-r--r-- | net-dns/openresolv/Manifest | 5 | ||||
-rw-r--r-- | net-dns/openresolv/files/pdnsd | 147 | ||||
-rw-r--r-- | net-dns/openresolv/openresolv-3.3.4-r1.ebuild | 52 |
4 files changed, 144 insertions, 68 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/Manifest b/net-dns/openresolv/Manifest index ed2fafb5bcb9..555d8e787848 100644 --- a/net-dns/openresolv/Manifest +++ b/net-dns/openresolv/Manifest @@ -1,7 +1,8 @@ -AUX pdnsd 18322 RMD160 6a49910f65ff18dafe573d26480c6e4d40eb7dc3 SHA1 a71ce938fc8b1aafb34a1099dfc825340bc44972 SHA256 52b947ddcd3bb1308c24d10d4a6deabca9474c758d5563e3e2547f9cbbc5847e +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 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 1446 RMD160 a173aab8aac06c3b77e36148c29dd53f91a564fe SHA1 929f30b479eb5816070555a222765f3632c3e064 SHA256 5aafcc84bf0fab1f774f3ea5ef1a22b1483cb3a2dee7c102eac770cd36a7f52e -MISC ChangeLog 7479 RMD160 1300181dce2047d82600b735cfd9b6e53f48a5dc SHA1 a9ea3cb86dd5c0e18f85c7ffc370654c1cf2ad84 SHA256 a6239b02d0f314a3b7ef979dac93de4ed8150d389a425217492c13482318eb82 +MISC ChangeLog 7665 RMD160 2e848d178ed8f0e8cd2a29bc5604f9bbe69e09e6 SHA1 538b673cf6ee5d09af4f3d54ecc64f49d528f5f7 SHA256 ec45ef6d0efa9944e37a4fe070ed7d238bece8c301c2ce1d56d6829d3a171f9c MISC metadata.xml 407 RMD160 bc0655eb7762cddca121e3e2d75878723be9d751 SHA1 cd1f19d5ad1161f1fc701e0fc755e4165f49bc5b SHA256 4526608e180ccadf270ea13601c244268e3d9dff940c2d303ec63ffa30474861 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 +} |