1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-20 04:02:27 +00:00
freebsd-ports/security/openvpn/files/up-script.sample
Matthias Andree 5cd430e650 Add an 'up' script for resolvconf integration, ...
contributed by Bapt@, but not yet touched up.
Needs proper license notice and documentation.
Therefore not yet linked to the build/install.
2016-01-12 09:07:45 +00:00

28 lines
782 B
Bash

#!/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