#!/bin/bash if [ "${PEER_DNS}" != "no" ]; then NS= DOMAIN= SEARCH= i=1 while true ; do eval opt=\$foreign_option_${i} [ -z "${opt}" ] && break if [ "${opt}" != "${opt#dhcp-option DOMAIN *}" ] ; then if [ -z "${DOMAIN}" ] ; then DOMAIN="${opt#dhcp-option DOMAIN *}" else SEARCH="${SEARCH}${SEARCH:+ }${opt#dhcp-option DOMAIN *}" fi elif [ "${opt}" != "${opt#dhcp-option DNS *}" ] ; then NS="${NS}nameserver ${opt#dhcp-option DNS *}\n" fi i=$((${i} + 1)) done if [ -n "${NS}" ] ; then DNS="# Generated by openvpn for interface ${dev}\n" if [ -n "${SEARCH}" ] ; then DNS="${DNS}search ${DOMAIN} ${SEARCH}\n" elif [ -n "${DOMAIN}" ]; then DNS="${DNS}domain ${DOMAIN}\n" fi DNS="${DNS}${NS}" if [ -x /sbin/resolvconf ] ; then printf "${DNS}" | /sbin/resolvconf -a "${dev}" else # Preserve the existing resolv.conf if [ -e /etc/resolv.conf ] ; then cp /etc/resolv.conf /etc/resolv.conf-"${dev}".sv fi printf "${DNS}" > /etc/resolv.conf chmod 644 /etc/resolv.conf fi fi fi /etc/transmission/start.sh "$@" [[ ! -f /opt/tinyproxy/start.sh ]] || /opt/tinyproxy/start.sh exit 0