View | Details | Raw Unified | Return to bug 134692
Collapse All | Expand All

(-) (-6 / +26 lines)
Line  Link Here
-- scripts/modify_resolvconf
Lines 210-217 write_namedconf () { Link Here
210
      # Yes, put the comment right after that comment
210
      # Yes, put the comment right after that comment
211
      sed -e "/^[[:space:]]*# your provider's name server./a\        forwarders {$FORWDS };" $TMP_FILE > $TMP_DATA
211
      sed -e "/^[[:space:]]*# your provider's name server./a\        forwarders {$FORWDS };" $TMP_FILE > $TMP_DATA
212
    else
212
    else
213
      # No, so just put the option right after the "options {" block opening
213
      # No active forwarders
214
      sed -e "/^options {/a\        forwarders {$FORWDS };" $TMP_FILE > $TMP_DATA
214
      case "$FILENAME" in
215
        (*/named.conf)
216
          # Just put the option right after the "options {" block opening
217
          # (legacy code in case user set NAMEDCONF back to /etc/named.conf)
218
          sed -e "/^options {/a\        forwarders {$FORWDS };" $TMP_FILE > $TMP_DATA
219
        ;;
220
        (*)
221
	  # forwarders.conf -- just append the forwarders...
222
          (cat $TMP_FILE;
223
           echo "";
224
           echo "        forwarders {$FORWDS };";
225
           echo "";) > $TMP_DATA
226
        ;;
227
      esac
215
    fi
228
    fi
216
  fi
229
  fi
217
}
230
}
Lines 228-235 write_file () { Link Here
228
}
241
}
229
242
230
read_file () {
243
read_file () {
231
  sed "/### BEGIN INFO/,/### END INFO/d" $FILENAME > $TMP_DATA
244
  [ -e $FILENAME ] && sed "/### BEGIN INFO/,/### END INFO/d" $FILENAME > $TMP_DATA
232
  echo "" >> $TMP_DATA
245
  #echo "" >> $TMP_DATA
233
  case "$FILENAME" in
246
  case "$FILENAME" in
234
    *resolv*) read_resolvconf; ;;
247
    *resolv*) read_resolvconf; ;;
235
    *named*)  read_namedconf; ;;
248
    *named*)  read_namedconf; ;;
Lines 442-448 case "$FILENAME" in Link Here
442
    exit
455
    exit
443
    ;;
456
    ;;
444
  $NAMEDCONF)
457
  $NAMEDCONF)
445
    if ! [ -r "$FILENAME" -a -x /etc/init.d/named ] ; then
458
    if ! [ -d "${FILENAME%/*}/" -a -x /etc/init.d/named ] ; then
446
      if [ "$ACTION" = "cleanup" ] ; then
459
      if [ "$ACTION" = "cleanup" ] ; then
447
        exit 0
460
        exit 0
448
      else
461
      else
Lines 451-456 case "$FILENAME" in Link Here
451
        log "Check your settings of MODIFY_RESOLV\NAMED_CONF_DYNAMICALLY"
464
        log "Check your settings of MODIFY_RESOLV\NAMED_CONF_DYNAMICALLY"
452
        exit 1
465
        exit 1
453
      fi
466
      fi
467
    elif [ "$ACTION" != "cleanup" -a \
468
           -r /etc/named.conf -a "${NAMEDCONF##*/}" != named.conf ] ; then
469
    	grep -qs -e "^[[:space:]]*include.*${NAMEDCONF}" /etc/named.conf || {
470
	  debug "WARNING: Service $SERVICE will try to modify $FILENAME, but the" \
471
                "/etc/named.conf seems not to include it."
472
	  debug "         Add an include \"$NAMEDCONF\"; statement inside of the" \
473
                "options { }; block to the /etc/named.conf."
474
	}
454
    fi
475
    fi
455
    ;;
476
    ;;
456
  $RESOLVCONF)
477
  $RESOLVCONF)

Return to bug 134692