summaryrefslogtreecommitdiff
path: root/system/s6/s6-svscanboot
blob: 2b41d29160e282a6e5b7c690fea4b217775c3890 (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
#!/bin/execlineb -S1

foreground { redirfd -w 2 /dev/null mkdir -p /run/uncaught-logs }
if { chown catchlog:catchlog /run/uncaught-logs }
if { chmod 2700 /run/uncaught-logs }
foreground { redirfd -w 2 /dev/null mkdir -p ${1}/.s6-svscan ${1}/s6-svscan-log }
foreground { redirfd -w 2 /dev/null ln -sf /bin/false ${1}/.s6-svscan/crash }
if
{
  redirfd -w 1 ${1}/.s6-svscan/finish
  heredoc 0 "#!/bin/execlineb -P\ns6-svc -X -- \"${1}/s6-svscan-log\"\n"
  cat
}
if { chmod 0755 ${1}/.s6-svscan/finish }
foreground { redirfd -w 2 /dev/null mkfifo -m 0600 ${1}/s6-svscan-log/fifo }
if
{
  redirfd -w 1 ${1}/s6-svscan-log/run
  heredoc 0 "#!/bin/execlineb -P
redirfd -w 2 /dev/console
redirfd -rnb 0 fifo
s6-setuidgid catchlog
exec -c
s6-log t /run/uncaught-logs\n"
  cat
}
if { chmod 0755 ${1}/s6-svscan-log/run }

redirfd -r 0 /dev/null
redirfd -wnb 1 ${1}/s6-svscan-log/fifo
fdmove -c 2 1
s6-svscan -St0 ${1}