1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/sh -e
- top="$1" ; shift
- if test -d /run/s6/container_environment ; then
- s6-chmod 0755 /run/s6/container_environment
- fi
- if profile=`printcontenv S6_RUNTIME_PROFILE` ; then
- etc="/etc/cont-profile.d/$profile"
- else
- etc=/etc
- fi
- s6-rc-compile -v1 /run/s6/db "$etc/s6-overlay/s6-rc.d" /package/admin/s6-overlay-@VERSION@/etc/s6-rc/sources
- s6-rc-init -c /run/s6/db /run/service
- if timeout=`printcontenv S6_CMD_WAIT_FOR_SERVICES_MAXTIME` && test "$timeout" -ge 0 ; then : ; else
- timeout=5000
- fi
- set +e
- s6-rc -v2 -u -t "$timeout" -- change "$top"
- r=$?
- set -e
- if test "$r" -ne 0 && b=0`printcontenv S6_BEHAVIOUR_IF_STAGE2_FAILS` && test "$b" -ne 0 ; then
- echo '/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.' 1>&2
- if test "$b" -ge 2 ; then
- echo '/run/s6/basedir/scripts/rc.init: fatal: stopping the container.' 1>&2
- echo "$r" > /run/s6-linux-init-container-results/exitcode
- exec /run/s6/basedir/bin/halt
- fi
- fi
- if test "$#" -ne 0 ; then
- cd `s6-cat < /run/s6/workdir`
- set +e
- arg0=`printcontenv S6_CMD_ARG0`
- $arg0 "$@"
- echo "$?" > /run/s6-linux-init-container-results/exitcode
- set -e
- exec /run/s6/basedir/bin/halt
- fi
|