diff options
Diffstat (limited to 'security/openvpn25/files/up-script.sample')
-rw-r--r-- | security/openvpn25/files/up-script.sample | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/security/openvpn25/files/up-script.sample b/security/openvpn25/files/up-script.sample new file mode 100644 index 000000000000..2b9acee3dc85 --- /dev/null +++ b/security/openvpn25/files/up-script.sample @@ -0,0 +1,27 @@ +#!/bin/sh +# OpenVPN simple up/down script for openresolvconf integration. +# (C) Copyright 2016 Baptiste Daroussin +# BSD 2-clause license. + +set -e +u +: ${script_type:=down} +case "${script_type}" in +up) + i=1 + while :; do + eval option=\"\$foreign_option_${i}\" || break + [ "${option}" ] || break + set -- ${option} + i=$((i + 1)) + [ "$1" = "dhcp-option" ] || continue + case "$2" in + DNS) echo "nameserver ${3}" ;; + DOMAIN) echo "domain ${3}" ;; + DOMAIN-SEARCH) echo "search ${3}" ;; + esac + done | /sbin/resolvconf -a "${dev}" + ;; +down) + /sbin/resolvconf -d "${dev}" -f + ;; +esac |