summaryrefslogtreecommitdiff
path: root/dev-util/schroot/files/schroot.initd
blob: be58c3a0f2d0ef20a022b1593435dc4de2faec64 (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
#!/sbin/openrc-run

depend() {
	need localmount
	after net netmount
}

start() {
	local msg param
	case "${SESSIONS_RECOVER}" in
		end)
			msg="Ending"
			param="--end-session"
			;;
		recover|"")
			msg="Recovering"
			param="--recover-session"
			;;
		*)
			ewarn "Invalid value \"$SESSIONS_RECOVER\" for \$SESSIONS_RECOVER, using \"recover\""
			msg="Recovering"
			param="--recover-session"
			;;
	esac

	einfo "$msg schroot sessions"
	eindent
	local chroot
	local chroots="$(schroot --all-sessions --list --quiet)"
	if [ -n "$chroots" ]; then
		for chroot in $chroots; do
			ebegin "$chroot"
			schroot --chroot=$chroot $param
			eend $?
		done
	else
		einfo "(none)"
	fi
	eoutdent
	einfo "...done"
}