Debian Codegraph @

support/openvpn/down.sh

raw
1 #!/bin/sh
2 # Copyright (c) 2007-2015 The OpenRC Authors.
3 # See the Authors file at the top-level directory of this distribution and
4 # https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
5 #
6 # This file is part of OpenRC. It is subject to the license terms in
7 # the LICENSE file found in the top-level directory of this
8 # distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
9 # This file may not be copied, modified, propagated, or distributed
10 # except according to the terms contained in the LICENSE file.
11
12 # If we have a service specific script, run this now
13 [ -x "${RC_SVCNAME}"-down.sh ] && "${RC_SVCNAME}"-down.sh
14
15 # Restore resolv.conf to how it was
16 if command -v resolvconf >/dev/null 2>&1; then
17 resolvconf -d "${dev}"
18 elif [ -e /etc/resolv.conf-"${dev}".sv ]; then
19 # Important that we copy instead of move in case resolv.conf is
20 # a symlink and not an actual file
21 cp -p /etc/resolv.conf-"${dev}".sv /etc/resolv.conf
22 rm -f /etc/resolv.conf-"${dev}".sv
23 fi
24
25 # Re-enter the init script to stop any dependent services
26 if [ -x "${RC_SERVICE}" ]; then
27 if "${RC_SERVICE}" --quiet status; then
28 IN_BACKGROUND=YES
29 export IN_BACKGROUND
30 "${RC_SERVICE}" --quiet stop
31 fi
32 fi
33
34 exit 0