File client-netconfig.down of Package openvpn

#!/bin/bash

# Copyright (c) 2010 Andreas Schneider <anschneider@exsuse.de>
#                    Marius Tomaschewski <mt@suse.de>
# Licensed under the GPL version 2

# PURPOSE: This script automatically removes the /etc/resolv.conf
#          and another settings applied before via netconfig.

# INSTALL NOTES:
# Place this file in /etc/openvpn/client.down
# Then, add the following to your /etc/openvpn/<clientconfig>.conf:
#   client
#   pull dhcp-options
#   up   /etc/openvpn/client.up
#   down /etc/openvpn/client.down
# Finally, "chmod +x /etc/openvpn/client.{up,down}"

# disable pathname expansion
shopt -o -s noglob

# --up/--down patametes are:
#
#   tun_dev tun_mtu link_mtu ifconfig_local_ip
#           ifconfig_remote_ip [ init | restart ]
#
#   tap_dev tap_mtu link_mtu ifconfig_local_ip
#           ifconfig_netmask [ init | restart ]
dev=$1

# skip, when there is no interface parameter or netconfig
if test -a /sbin/netconfig -a "x${dev}" != x ; then
  /sbin/netconfig remove -s openvpn -i "${dev}"
fi

# all done...
exit 0