Changeset View
Changeset View
Standalone View
Standalone View
dnsmasq.in
| #!/bin/sh | #!/bin/sh | ||||
| # Copyright (c) 2007-2019 Roy Marples | # Copyright (c) 2007-2023 Roy Marples | ||||
| # All rights reserved | # All rights reserved | ||||
| # dnsmasq subscriber for resolvconf | # dnsmasq subscriber for resolvconf | ||||
| # Redistribution and use in source and binary forms, with or without | # Redistribution and use in source and binary forms, with or without | ||||
| # modification, are permitted provided that the following conditions | # modification, are permitted provided that the following conditions | ||||
| # are met: | # are met: | ||||
| # * Redistributions of source code must retain the above copyright | # * Redistributions of source code must retain the above copyright | ||||
| ▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | if $dbus && ! $dbus_ex; then | ||||
| set -- $n | set -- $n | ||||
| while [ -n "$1" ] || [ -n "$2" ]; do | while [ -n "$1" ] || [ -n "$2" ]; do | ||||
| addr="$1" | addr="$1" | ||||
| shift | shift | ||||
| if [ -z "$addr" ]; then | if [ -z "$addr" ]; then | ||||
| empty=true | empty=true | ||||
| continue | continue | ||||
| fi | fi | ||||
| i=$(($i + 1)) | i=$((i + 1)) | ||||
| while [ ${#addr} -lt 4 ]; do | while [ ${#addr} -lt 4 ]; do | ||||
| addr="0${addr}" | addr="0${addr}" | ||||
| done | done | ||||
| byte1="$(printf %d 0x${addr%??})" | byte1="$(printf %d 0x${addr%??})" | ||||
| byte2="$(printf %d 0x${addr#??})" | byte2="$(printf %d 0x${addr#??})" | ||||
| if $empty; then | if $empty; then | ||||
| back="$back byte:$byte1 byte:$byte2" | back="$back byte:$byte1 byte:$byte2" | ||||
| else | else | ||||
| front="$front byte:$byte1 byte:$byte2" | front="$front byte:$byte1 byte:$byte2" | ||||
| fi | fi | ||||
| done | done | ||||
| while [ $i != 8 ]; do | while [ $i != 8 ]; do | ||||
| i=$(($i + 1)) | i=$((i + 1)) | ||||
| front="$front byte:0 byte:0" | front="$front byte:0 byte:0" | ||||
| done | done | ||||
| front="${front}$back" | front="${front}$back" | ||||
| if [ "$SIFS" = y ]; then | if [ "$SIFS" = y ]; then | ||||
| unset IFS | unset IFS | ||||
| else | else | ||||
| IFS=$OIFS | IFS=$OIFS | ||||
| fi | fi | ||||
| Show All 16 Lines | |||||
| if $dbus; then | if $dbus; then | ||||
| newconf="$newconf$NL# Domain specific servers will" | newconf="$newconf$NL# Domain specific servers will" | ||||
| newconf="$newconf be sent over dbus${NL}" | newconf="$newconf be sent over dbus${NL}" | ||||
| else | else | ||||
| newconf="$newconf$conf" | newconf="$newconf$conf" | ||||
| fi | fi | ||||
| # Try to ensure that config dirs exist | # Try to ensure that config dirs exist | ||||
| if type config_mkdirs >/dev/null 2>&1; then | if command -v config_mkdirs >/dev/null 2>&1; then | ||||
| config_mkdirs "$dnsmasq_conf" "$dnsmasq_resolv" | config_mkdirs "$dnsmasq_conf" "$dnsmasq_resolv" | ||||
| else | else | ||||
| @SBINDIR@/resolvconf -D "$dnsmasq_conf" "$dnsmasq_resolv" | @SBINDIR@/resolvconf -D "$dnsmasq_conf" "$dnsmasq_resolv" | ||||
| fi | fi | ||||
| changed=false | changed=false | ||||
| if [ -n "$dnsmasq_conf" ]; then | if [ -n "$dnsmasq_conf" ]; then | ||||
| if [ ! -f "$dnsmasq_conf" ] || \ | if [ ! -f "$dnsmasq_conf" ] || \ | ||||
| ▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines | |||||