|
@@ -7,7 +7,6 @@ else
|
|
|
fi
|
|
|
|
|
|
dir=/run/s6/legacy-services
|
|
|
-echo "[s6-overlay] legacy-services: copying and starting services in $etc/services.d"
|
|
|
|
|
|
s6-rmrf "$dir"
|
|
|
s6-mkdir -p -m 0755 "$dir"
|
|
@@ -17,10 +16,13 @@ notifyes=
|
|
|
for i in `s6-ls "$etc/services.d" 2>/dev/null | s6-sort` ; do
|
|
|
if test -d "$etc/services.d/$i" ; then
|
|
|
list="$list $i"
|
|
|
+ s6-echo -n -- "services-up: info: copying legacy longrun $i" 1>&2
|
|
|
if test -r "$dir/$i/notification-fd" ; then
|
|
|
notifyes="$notifyes $dir/$i"
|
|
|
+ echo 1>&2
|
|
|
else
|
|
|
notifno="$notifno $dir/$i"
|
|
|
+ echo ' (no readiness notification)' 1>&2
|
|
|
fi
|
|
|
s6-hiercopy "$etc/services.d/$i" "$dir/$i"
|
|
|
fi
|
|
@@ -36,21 +38,21 @@ if test 0`printcontenv S6_CMD_WAIT_FOR_SERVICES` -ne 0 ; then
|
|
|
if ! maxtime=`printcontenv S6_CMD_WAIT_FOR_SERVICES_MAXTIME` ; then
|
|
|
maxtime=0
|
|
|
fi
|
|
|
- echo "[s6-overlay] legacy-services: waiting for services to get ready..."
|
|
|
|
|
|
# Increase if necessary. Unavoidable race condition, use s6-rc instead!
|
|
|
s6-sleep -m 5
|
|
|
|
|
|
- r=0
|
|
|
+ r=false
|
|
|
if test -n "$notifno" && ! s6-svwait -u -t "$maxtime" -- $notifno ; then
|
|
|
- r=1
|
|
|
+ r=true
|
|
|
fi
|
|
|
if test -n "$notifyes" && ! s6-svwait -U -t "$maxtime" -- $notifyes ; then
|
|
|
- r=1
|
|
|
+ r=true
|
|
|
fi
|
|
|
- if test "$r" -ne 0 && b=`printcontenv S6_BEHAVIOUR_IF_STAGE2_FAILS` && test "$b" -eq 2 ; then
|
|
|
- echo "[s6-overlay] legacy-services: ... failed"
|
|
|
- exit 1
|
|
|
+ if $r && b=0`printcontenv S6_BEHAVIOUR_IF_STAGE2_FAILS` && test "$b" -ne 0 ; then
|
|
|
+ echo 'services-up: warning: some legacy longruns failed to start' 1>&2
|
|
|
+ if test "$b" -ge 2 ; then
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
fi
|
|
|
- echo "[s6-overlay] legacy-services: ... done"
|
|
|
fi
|