blob: 521a2bc061335821ea6ef204aa59c8efb444ea5c (
plain) (
blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
|
#!/bin/execlineb -P
importas -D "/etc" -S XDG_CONFIG_HOME
importas -D "/run" -S XDG_RUNTIME_DIR
envfile -I /opt/svtree/dirs.conf
# compile s6-rc db
foreground { /opt/svtree/bin/svtree-compile }
# check that we have the db
if { eltest -e ${COMPILED_DIR} }
# TODO: cgroup support
#define CG /sys/fs/cgroup/usr
#if { test -d ${CG} }
#if { test -w ${CG}/cgroup.procs }
# nuke any other svscan process
foreground { s6-svscanctl -qN ${SCAN_DIR} }
foreground { s6-svwait -D ${SCAN_DIR}/s6rc-fdholder }
# cleanup
foreground { rm -rf ${SCAN_DIR} }
foreground { elglob l ${LIVE_DIR}* rm -rf ${l} }
# setup rundir
if { cp -va -- ${CONF_DIR}/run-image/service ${SCAN_DIR} }
background {
# catch-all logger
fdmove -c 4 2
redirfd -wnb 2 ${SCAN_DIR}/s6-svscan-log/fifo
fdmove -c 1 2
# TODO: why do we need this?
execline-cd ${HOME}
# run s6
s6-svscan ${SCAN_DIR}
}
# setup s6-rc
foreground { s6-rc-init -c ${COMPILED_DIR} -l ${LIVE_DIR} -d -- ${SCAN_DIR} }
# launch default target
foreground { s6-rc -v2 -l ${LIVE_DIR} -pu change default }
# block on s6
importas -i scanpid !
wait -i { ${scanpid} }
exit 0
|