summaryrefslogtreecommitdiff
blob: 8bc2681f6c8cdf4a47907cd84862968652dabbf1 (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
#!/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)

MODULES_DIR="/lib/rcscripts/net.modules.d"
. /lib/rcscripts/sh/rc-services.sh
. "${MODULES_DIR}/helpers.d/functions"
conf=$(add_suffix "/etc/conf.d/net")
[[ -e ${conf} ]] && source "${conf}"

service="net.${interface}"

if [[ ${action} != "up" ]]; then
	if service_starting "${service}" || service_started "${service}" ; then
		mark_service_inactive "${service}"
	fi
	remove_state "${interface}" false
else
	! service_stopping "${service}" && mark_service_started "${service}"
fi

if [[ ${RC_AUTO_INTERFACE} == "yes" ]]; then
	best_interface=$( select_best_interface )
	apply_state "${best_interface}"
elif [[ ${action} == "up" ]]; then
	apply_state "${interface}"
fi

# vim:ts=4