Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 518484
Collapse All | Expand All

(-)a/app-emulation/lxc/files/lxc.initd.2 (-18 / +23 lines)
Lines 24-29 lxc_get_var() { Link Here
24
	awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
24
	awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
25
}
25
}
26
26
27
lxc_get_net_link_type() {
28
	awk 'BEGIN { FS="[ \t]*=[ \t]*"; _link=""; _type="" }
29
		$1 == "lxc.network.type" {_type=$2;}
30
		$1 == "lxc.network.link" {_link=$2;}
31
		{if(_link != "" && _type != ""){
32
			printf("%s:%s\n", _link, _type );
33
			_link=""; _type="";
34
		}; }' <${CONFIGFILE}
35
}
36
27
checkconfig() {
37
checkconfig() {
28
	if [ ${CONTAINER} = ${SVCNAME} ]; then
38
	if [ ${CONTAINER} = ${SVCNAME} ]; then
29
		eerror "You have to create an init script for each container:"
39
		eerror "You have to create an init script for each container:"
Lines 50-73 depend() { Link Here
50
	config ${CONFIGFILE}
60
	config ${CONFIGFILE}
51
	need localmount
61
	need localmount
52
62
53
	# find out which network interface the container is linked to,
63
	local _x _if
54
	# and then require that to be enabled, so that the
64
	for _x in $(lxc_get_net_link_type); do
55
	# dependencies are correct.
65
		_if=${_x%:*}
56
	netif=$(lxc_get_var lxc.network.link)
66
		case "${_x##*:}" in
57
67
			# when the network type is set to phys, we can make use of a
58
	# when the network type is set to phys, we can make use of a
68
			# network service (for instance to set it up before we disable
59
	# network service (for instance to set it up before we disable
69
			# the net_admin capability), but we might also not set it up
60
	# the net_admin capability), but we might also not set it up
70
			# at all on the host and leave the net_admin capable service
61
	# at all on the host and leave the net_admin capable service
71
			# to take care of it.
62
	# to take care of it.
72
			phys)	use net.${_if} ;;
63
	nettype=$(lxc_get_var lxc.network.type)
73
			*)	need net.${_if} ;;
64
74
		esac
65
	if [ -n "${netif}" ]; then
75
	done
66
	    case "${nettype}" in
67
		phys)	use net.${netif} ;;
68
		*)	need net.${netif} ;;
69
	    esac
70
	fi
71
}
76
}
72
77
73
start() {
78
start() {

Return to bug 518484