#!/mod/bin/jimsh

set services [split [exec /mod/bin/service mlist]]

foreach service $services {
	lassign [split $service ":"] name installed auto running

	puts "<tr><td class=even>$name</td>"
	if (!$installed) {
		puts "<td colspan=3><i>Not installed</i></td></tr>"
		continue
	}

	puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
	if ($auto) { puts -nonewline " checked" }
	puts "></td>"

	puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\""
	if ($running) { puts -nonewline " checked" }
	puts "></td>"

	puts "</tr>"
}

