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

(-)/usr/portage/app-emulation/lxc/files/lxc.initd (-3 / +27 lines)
Lines 20-25 Link Here
20
20
21
[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
21
[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)}
22
22
23
lxc_try_script() {
24
       SCRIPT_TYPE=$1
25
       SCRIPT_NAME=""
26
       if [ -f "/etc/lxc/${CONTAINER}.${SCRIPT_TYPE}" ]; then
27
                SCRIPT_NAME="/etc/lxc/${CONTAINER}.${SCRIPT_TYPE}"
28
        elif [ -f "/etc/lxc/${CONTAINER}/${SCRIPT_TYPE}" ]; then
29
                SCRIPT_NAME="/etc/lxc/${CONTAINER}/${SCRIPT_TYPE}"
30
        fi
31
       if [ "${SCRIPT_NAME}" != "" ]
32
       then
33
               ebegin "Starting ${SCRIPT_NAME}"
34
               ${SCRIPT_NAME}
35
               eend $?
36
       fi
37
}
38
39
23
lxc_get_var() {
40
lxc_get_var() {
24
	awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
41
	awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE}
25
}
42
}
Lines 91-104 Link Here
91
		ELFCLASS64:ELFCLASS32:) setarch=linux32;;
108
		ELFCLASS64:ELFCLASS32:) setarch=linux32;;
92
	esac
109
	esac
93
110
111
	lxc_try_script preup
112
94
	ebegin "Starting ${CONTAINER}"
113
	ebegin "Starting ${CONTAINER}"
95
	env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
114
	env -i ${setarch} $(type -p lxc-start) -l DEBUG -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log
96
	sleep 0.5
115
	sleep 0.5
97
116
98
	# lxc-start -d will _always_ report a correct startup, even if it
117
	# lxc-start -d will _always_ report a correct startup, even if it
99
	# failed, so rather than trust that, check that the cgroup exists.
118
	# failed, so rather than trust that, check that the cgroup exists.
100
	[ -d ${cgroupmount}/${CONTAINER} ]
119
	[ -d ${cgroupmount}/${CONTAINER} ]
101
	eend $?
120
	started=$?
121
	eend ${started}
122
	[[ ${started} == 0 ]] && lxc_try_script postup
102
}
123
}
103
124
104
stop() {
125
stop() {
Lines 111-116 Link Here
111
	    return 0
132
	    return 0
112
	fi
133
	fi
113
134
135
	lxc_try_script predown
114
	init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)
136
	init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2)
115
137
116
	if [ "${init_pid}" = "-1" ]; then
138
	if [ "${init_pid}" = "-1" ]; then
Lines 135-139 Link Here
135
157
136
	ebegin "Stopping ${CONTAINER}"
158
	ebegin "Stopping ${CONTAINER}"
137
	lxc-stop -n ${CONTAINER}
159
	lxc-stop -n ${CONTAINER}
138
	eend $?
160
	stopped=$?
161
	eend ${stopped}
162
	[[ ${stopped} == 0 ]] && lxc_try_script postdown
139
}
163
}

Return to bug 409189