Skip to content

Commit

Permalink
allow executing commands within supervised environment
Browse files Browse the repository at this point in the history
  • Loading branch information
glerchundi committed Feb 28, 2015
1 parent 6677f86 commit a6f1847
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 22 deletions.
5 changes: 3 additions & 2 deletions rootfs/etc/s6/.s6-init/init-stage1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/execlineb -P
#!/usr/bin/execlineb

##
## dump environment into files and a bash script
Expand Down Expand Up @@ -49,7 +49,8 @@ foreground { s6-sync }

background
{
/etc/s6/.s6-init/init-stage2
elgetpositionals
/etc/s6/.s6-init/init-stage2 $@
}
unexport !

Expand Down
32 changes: 18 additions & 14 deletions rootfs/etc/s6/.s6-init/init-stage2
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
#!/usr/bin/execlineb -P
#!/usr/bin/execlineb

# this file is executed (not as process 1!) as soon as s6-svscan
# starts. It should perform all the remaining one-time initialization
# tasks.

if -nt
{
##
## cont-init.d
##
elgetpositionals
ifelse { s6-test $# -ne 0 }
{ foreground { $@ } s6-svscanctl -t /etc/s6 }

foreground { s6-echo "[cont-init.d] executing container initialization scripts..." }
foreground {
forbacktickx i {
find /etc/cont-init.d -maxdepth 1 -type f ! -name ".*" ! -path /etc/cont-init.d
##
## cont-init.d
##

foreground { s6-echo "[cont-init.d] executing container initialization scripts..." }
foreground {
forbacktickx i {
find /etc/cont-init.d -maxdepth 1 -type f ! -name ".*" ! -path /etc/cont-init.d
}
import i
foreground { s6-echo "[cont-init.d] ${i}: executing..." }
foreground { with-contenv ${i} }
foreground { s6-echo "[cont-init.d] ${i}: done." }
}
import i
foreground { s6-echo "[cont-init.d] ${i}: executing..." }
foreground { with-contenv ${i} }
foreground { s6-echo "[cont-init.d] ${i}: done." }
}
foreground { s6-echo "[cont-init.d] done." }
foreground { s6-echo "[cont-init.d] done." }
}

# if anything in the if -nt { } block fails, control jumps here.
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6/.s6-svscan/finish
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/execlineb -P
/etc/s6/.s6-init/init-stage3
#!/usr/bin/execlineb
/etc/s6/.s6-init/init-stage3
4 changes: 2 additions & 2 deletions rootfs/etc/s6/fdholderd/run
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
exec s6-notifywhenup s6-fdholder-daemon -1 -i /etc/s6/fdholderd/rules /etc/s6/fdholderd/socket
#!/usr/bin/execlineb
s6-notifywhenup s6-fdholder-daemon -1 -i /etc/s6/fdholderd/rules /etc/s6/fdholderd/socket
5 changes: 3 additions & 2 deletions rootfs/init
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/usr/bin/execlineb -P
/etc/s6/.s6-init/init-stage1
#!/usr/bin/execlineb
elgetpositionals
/etc/s6/.s6-init/init-stage1 $@

0 comments on commit a6f1847

Please sign in to comment.