blob: 2e7dc54ffe8194274baeb83c758688dee601eb32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/bin/bash
# Copyright (c) 2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Contributed by Roy Marples (uberlord@gentoo.org)
action="$1"
interface="$2"
export IN_BACKGROUND="true"
. /lib/rcscripts/net.modules.d/helpers.d/module-loader
resolv="${statedir}/${interface}/resolv.conf"
if [[ ${action} == "up" ]]; then
if [[ -n ${DNS1} || -n ${DNS2} ]]; then
echo "# Generated by pppd for interface $1" > "${resolv}"
chmod 0644 "${resolv}"
[ -n ${DNS1} ] && echo "nameserver ${DNS1}" >> "${resolv}"
[ -n ${DNS2} ] && echo "nameserver ${DNS2}" >> "${resolv}"
fi
# Calculate the metric for our routes
ifvar=$( bash_variable "${interface}" )
metric="metric_${ifvar}"
metric="${!metric}"
if [[ -z ${metric} ]]; then
if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
metric=$( calculate_metric "${interface}" )
else
metric="0"
fi
fi
[[ ${metric} != "0" ]] && interface_route_metric "${interface}" "${metric}"
if service_inactive "net.${interface}" ; then
export RC_INTERFACE_KEEP_CONFIG="yes"
/etc/init.d/net."${interface}" start
fi
else
/etc/init.d/net."${interface}" stop
fi
# vim:ts=4
|