unbound.in (302408) | unbound.in (304515) |
---|---|
1#!/bin/sh | 1#!/bin/sh |
2# Copyright (c) 2009-2014 Roy Marples | 2# Copyright (c) 2009-2016 Roy Marples |
3# All rights reserved 4 5# unbound subscriber for resolvconf 6 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# * Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 32. "@SYSCONFDIR@/resolvconf.conf" || exit 1 33[ -z "$unbound_conf" ] && exit 0 34[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" 35NL=" 36" 37 38: ${unbound_pid:=/var/run/unbound.pid} 39: ${unbound_service:=unbound} | 3# All rights reserved 4 5# unbound subscriber for resolvconf 6 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions 9# are met: 10# * Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 32. "@SYSCONFDIR@/resolvconf.conf" || exit 1 33[ -z "$unbound_conf" ] && exit 0 34[ -z "$RESOLVCONF" ] && eval "$(@SBINDIR@/resolvconf -v)" 35NL=" 36" 37 38: ${unbound_pid:=/var/run/unbound.pid} 39: ${unbound_service:=unbound} |
40: ${unbound_restart:=@RESTARTCMD ${unbound_service}@} | |
41newconf="# Generated by resolvconf$NL" 42 43for d in $DOMAINS; do 44 dn="${d%%:*}" 45 ns="${d#*:}" 46 case "$unbound_insecure" in 47 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) 48 newconf="$newconf${NL}server:$NL" --- 17 unchanged lines hidden (view full) --- 66 67# Try to ensure that config dirs exist 68if type config_mkdirs >/dev/null 2>&1; then 69 config_mkdirs "$unbound_conf" 70else 71 @SBINDIR@/resolvconf -D "$unbound_conf" 72fi 73 | 40newconf="# Generated by resolvconf$NL" 41 42for d in $DOMAINS; do 43 dn="${d%%:*}" 44 ns="${d#*:}" 45 case "$unbound_insecure" in 46 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) 47 newconf="$newconf${NL}server:$NL" --- 17 unchanged lines hidden (view full) --- 65 66# Try to ensure that config dirs exist 67if type config_mkdirs >/dev/null 2>&1; then 68 config_mkdirs "$unbound_conf" 69else 70 @SBINDIR@/resolvconf -D "$unbound_conf" 71fi 72 |
73restart_unbound() 74{ 75 if [ -n "$unbound_restart" ]; then 76 eval $unbound_restart 77 elif [ -n "$RESTARTCMD" ]; then 78 set -- ${unbound_service} 79 eval $RESTARTCMD 80 else 81 @SBINDIR@/resolvconf -r ${unbound_service} 82 fi 83} 84 |
|
74if [ ! -f "$unbound_conf" ] || \ 75 [ "$(cat "$unbound_conf")" != "$(printf %s "$newconf")" ] 76then 77 printf %s "$newconf" >"$unbound_conf" 78 # If we can't sent a HUP then force a restart 79 if [ -s "$unbound_pid" ]; then 80 if ! kill -HUP $(cat "$unbound_pid") 2>/dev/null; then | 85if [ ! -f "$unbound_conf" ] || \ 86 [ "$(cat "$unbound_conf")" != "$(printf %s "$newconf")" ] 87then 88 printf %s "$newconf" >"$unbound_conf" 89 # If we can't sent a HUP then force a restart 90 if [ -s "$unbound_pid" ]; then 91 if ! kill -HUP $(cat "$unbound_pid") 2>/dev/null; then |
81 eval $unbound_restart | 92 restart_unbound |
82 fi 83 else | 93 fi 94 else |
84 eval $unbound_restart | 95 restart_unbound |
85 fi 86fi | 96 fi 97fi |