X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=meta-starlingx%2Fmeta-stx-integ%2Frecipes-support%2Fdnsmasq%2Fdnsmasq%2Fdnsmasq.resolvconf;fp=meta-starlingx%2Fmeta-stx-integ%2Frecipes-support%2Fdnsmasq%2Fdnsmasq%2Fdnsmasq.resolvconf;h=0000000000000000000000000000000000000000;hb=6fc6934434f70595536a387ece31bc30141cafb5;hp=06cd25cececa515865a744591fdb3b37d0c895a4;hpb=eb1e26510491ba49de693ab3b0498edcb06be6c5;p=pti%2Frtp.git diff --git a/meta-starlingx/meta-stx-integ/recipes-support/dnsmasq/dnsmasq/dnsmasq.resolvconf b/meta-starlingx/meta-stx-integ/recipes-support/dnsmasq/dnsmasq/dnsmasq.resolvconf deleted file mode 100755 index 06cd25c..0000000 --- a/meta-starlingx/meta-stx-integ/recipes-support/dnsmasq/dnsmasq/dnsmasq.resolvconf +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# -# Script to update the resolver list for dnsmasq -# -# N.B. Resolvconf may run us even if dnsmasq is not (yet) running. -# If dnsmasq is installed then we go ahead and update the resolver list -# in case dnsmasq is started later. -# -# Assumption: On entry, PWD contains the resolv.conf-type files. -# -# This file is part of the dnsmasq package. -# - -set -e - -RUN_DIR="/run/dnsmasq" -RSLVRLIST_FILE="${RUN_DIR}/resolv.conf" -TMP_FILE="${RSLVRLIST_FILE}_new.$$" -MY_NAME_FOR_RESOLVCONF="dnsmasq" - -[ -x /usr/bin/dnsmasq ] || exit 0 -[ -x /lib/resolvconf/list-records ] || exit 1 - -PATH=/bin:/sbin - -report_err() { echo "$0: Error: $*" >&2 ; } - -# Stores arguments (minus duplicates) in RSLT, separated by spaces -# Doesn't work properly if an argument itself contains whitespace -uniquify() -{ - RSLT="" - while [ "$1" ] ; do - for E in $RSLT ; do - [ "$1" = "$E" ] && { shift ; continue 2 ; } - done - RSLT="${RSLT:+$RSLT }$1" - shift - done -} - -if [ ! -d "$RUN_DIR" ] && ! mkdir --parents --mode=0755 "$RUN_DIR" ; then - report_err "Failed trying to create directory $RUN_DIR" - exit 1 -fi - -RSLVCNFFILES="" -for F in $(/lib/resolvconf/list-records --after "lo.$MY_NAME_FOR_RESOLVCONF") ; do - case "$F" in - "lo.$MY_NAME_FOR_RESOLVCONF") - # Omit own record - ;; - lo.*) - # Include no more records after one for a local nameserver - RSLVCNFFILES="${RSLVCNFFILES:+$RSLVCNFFILES }$F" - break - ;; - *) - RSLVCNFFILES="${RSLVCNFFILES:+$RSLVCNFFILES }$F" - ;; - esac -done - -NMSRVRS="" -if [ "$RSLVCNFFILES" ] ; then - uniquify $(sed -n -e 's/^[[:space:]]*nameserver[[:space:]]\+//p' $RSLVCNFFILES) - NMSRVRS="$RSLT" -fi - -# Dnsmasq uses the mtime of $RSLVRLIST_FILE, with a resolution of one second, -# to detect changes in the file. This means that if a resolvconf update occurs -# within one second of the previous one then dnsmasq may fail to notice the -# more recent change. To work around this problem we sleep one second here -# if necessary in order to ensure that the new mtime is different. -if [ -f "$RSLVRLIST_FILE" ] && [ "$(stat -c %X "$RSLVRLIST_FILE")" = "$(date +%s)" ] ; then - sleep 1 -fi - -clean_up() { rm -f "$TMP_FILE" ; } -trap clean_up EXIT -: >| "$TMP_FILE" -for N in $NMSRVRS ; do echo "nameserver $N" >> "$TMP_FILE" ; done -mv -f "$TMP_FILE" "$RSLVRLIST_FILE" -