dot

packages and services management
Log | Files | Refs | README

commit 66548289db7211fd58b53b330b2c4dfd7a06b425
parent 42ec0a1714fa5fc9df6a288fa7114bf71c41fcd3
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri,  7 Dec 2018 01:58:52 +0100

bin/service-build: leave the /var/s6 directory in a clean state even on failure

Diffstat:
Mbin/service-build | 18+++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/bin/service-build b/bin/service-build @@ -1,7 +1,6 @@ #!/usr/bin/env execlineb elgetpositionals -if { mkdir -p /var/s6 } -cd /var/s6 +if { mkdir -p /var/s6 } cd /var/s6 forx -o 0 x { ${@} } importas sv x @@ -16,19 +15,24 @@ redirfd -r 0 /etc/s6/${base}/x/type withstdinas x importas -n type x -if { cd /etc/s6/${base} redirfd -w 1 /dev/null ls x ${mod} } - +if { cd /etc/s6/${base} redirfd -w 1 /dev/null ls -d ${mod} } if { rm -rf ${sv} ${sv},log } +ifte { } { if { rm -rf ${sv} ${sv},log } exit 1 } + +if { + forx -o 0 x { x $mod } importas x x + s6-hiercopy /etc/s6/${base}/${x} ${sv} +} + if { if -t { test $type = bundle } - forbacktickx -n -d "\n" x { sed "s/^#.*//; /^[ \t]*$/ d" ${sv}/contents } - importas x x + backtick -i x { sed "s/^#.*//; /^[ \t]*$/ d" ${sv}/contents } + importas -s -d "\n" x x service-build ${x} } if { if -t { test ${type} = longrun } - ifte { } { rm -rf ${sv} ${sv},log } ifthenelse { test -d /etc/s6/${sv}/log } { s6-hiercopy /etc/s6/${sv}/log ${sv},log } { s6-hiercopy /etc/s6/.s6-rc/service-log ${sv},log }