cont-init 812 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh -e
  2. r=false
  3. if profile=`printcontenv S6_RUNTIME_PROFILE` ; then
  4. etc="/etc/cont-profile.d/$profile"
  5. else
  6. etc=/etc
  7. fi
  8. if v=`printcontenv S6_VERBOSITY` && eltest "$v" =~ '^[[:digit:]]+$' ; then : ; else
  9. v=2
  10. fi
  11. for file in `s6-ls "$etc/cont-init.d" 2>/dev/null | s6-sort` ; do
  12. if test $v -ge 2 ; then
  13. echo "cont-init: info: running $etc/cont-init.d/$file" 1>&2
  14. fi
  15. set +e
  16. "$etc/cont-init.d/$file"
  17. b="$?"
  18. set -e
  19. if test $v -ge 2 ; then
  20. echo "cont-init: info: $etc/cont-init.d/$file exited $b" 1>&2
  21. fi
  22. if test "$b" -ne 0 ; then
  23. r=true
  24. fi
  25. done
  26. if $r && b=0`printcontenv S6_BEHAVIOUR_IF_STAGE2_FAILS` && test "$b" -ne 0 ; then
  27. if test $v -ge 1 ; then
  28. echo 'cont-init: warning: some scripts exited nonzero' 1>&2
  29. fi
  30. if test "$b" -ge 2 ; then
  31. exit 1
  32. fi
  33. fi