Skip to content

Commit

Permalink
replace forstdin with elglob
Browse files Browse the repository at this point in the history
  • Loading branch information
jprjr committed Jan 17, 2021
1 parent 26a5168 commit 3e7bc9f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
42 changes: 28 additions & 14 deletions builder/overlay-rootfs/etc/s6/init/init-stage2
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ foreground
if { s6-echo "[fix-attrs.d] applying ownership & permissions fixes..." }
if
{
pipeline { s6-ls -0 -- /var/run/s6/etc/fix-attrs.d }
pipeline { s6-sort -0 -- }
forstdin -0 -- i
importas -u i i
elglob -s0 g "/var/run/s6/etc/fix-attrs.d/*"
forx d { $g }
importas -ui d d
backtick -n i {
s6-basename "$d"
}
importas -ui i i
if { s6-echo -- "[fix-attrs.d] ${i}: applying... " }
foreground { redirfd -r 0 /var/run/s6/etc/fix-attrs.d/${i} fix-attrs }
importas -u ? ?
Expand All @@ -110,10 +113,13 @@ foreground
if { s6-echo "[cont-init.d] executing container initialization scripts..." }
if
{
pipeline { s6-ls -0 -- /var/run/s6/etc/cont-init.d }
pipeline { s6-sort -0 -- }
forstdin -o 0 -0 -- i
importas -u i i
elglob -s0 g "/var/run/s6/etc/cont-init.d/*"
forx d { $g }
importas -ui d d
backtick -n i {
s6-basename "$d"
}
importas -ui i i
if { s6-echo -- "[cont-init.d] ${i}: executing... " }
foreground { /var/run/s6/etc/cont-init.d/${i} }
importas -u ? ?
Expand All @@ -134,9 +140,13 @@ foreground
if { s6-echo "[services.d] starting services" }
if
{
pipeline { s6-ls -0 -- /var/run/s6/etc/services.d }
forstdin -0 -p -- i
importas -u i i
elglob -s0 g "/var/run/s6/etc/services.d/*"
forx -p d { $g }
importas -ui d d
backtick -n i {
s6-basename "$d"
}
importas -ui i i
if { s6-test -d /var/run/s6/etc/services.d/${i} }
s6-hiercopy /var/run/s6/etc/services.d/${i} /var/run/s6/services/${i}
}
Expand All @@ -151,9 +161,13 @@ foreground

if -t { if { s6-test ${S6_CMD_WAIT_FOR_SERVICES} -ne 0 } s6-test $# -ne 0 }
s6-maximumtime -t ${S6_CMD_WAIT_FOR_SERVICES_MAXTIME}
pipeline { s6-ls -0 -- /var/run/s6/etc/services.d }
forstdin -0 -o 0 -- i
importas -u i i
elglob -s0 g "/var/run/s6/etc/services.d/*"
forx -o 0 d { $g }
importas -ui d d
backtick -n i {
s6-basename "$d"
}
importas -ui i i
ifelse { s6-test -f /var/run/s6/services/${i}/down } { exit 0 }
ifelse { s6-test -f /var/run/s6/services/${i}/notification-fd }
{
Expand Down
11 changes: 7 additions & 4 deletions builder/overlay-rootfs/etc/s6/init/init-stage3
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ foreground
if { s6-echo "[cont-finish.d] executing container finish scripts..." }
if
{
pipeline { s6-ls -0 -- /var/run/s6/etc/cont-finish.d }
pipeline { s6-sort -0 -- }
forstdin -o 0 -0 -- i
importas -u i i
elglob -s0 g "/var/run/s6/etc/cont-finish.d/*"
forx d { $g }
importas -ui d d
backtick -n i {
s6-basename "$d"
}
importas -ui i i
if { s6-echo -- "[cont-finish.d] ${i}: executing... " }
foreground
{
Expand Down

0 comments on commit 3e7bc9f

Please sign in to comment.