support finish script in longrun
This commit is contained in:
parent
17517dd34f
commit
72171021e3
@ -14,8 +14,9 @@ let
|
|||||||
. ${serviceFns}
|
. ${serviceFns}
|
||||||
${commands}
|
${commands}
|
||||||
'';
|
'';
|
||||||
cleanupScript = name : ''
|
cleanupScript = name : cmds : ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
${if cmds != null then cmds else ""}
|
||||||
if test -d ${prefix}/${name} ; then rm -rf ${prefix}/${name} ; fi
|
if test -d ${prefix}/${name} ; then rm -rf ${prefix}/${name} ; fi
|
||||||
'';
|
'';
|
||||||
service = {
|
service = {
|
||||||
@ -51,6 +52,7 @@ let
|
|||||||
longrun = {
|
longrun = {
|
||||||
name
|
name
|
||||||
, run
|
, run
|
||||||
|
, finish ? null
|
||||||
, notification-fd ? null
|
, notification-fd ? null
|
||||||
, buildInputs ? []
|
, buildInputs ? []
|
||||||
, producer-for ? null
|
, producer-for ? null
|
||||||
@ -68,7 +70,7 @@ let
|
|||||||
buildInputs = buildInputs ++ lib.optional (producer-for == null) logger;
|
buildInputs = buildInputs ++ lib.optional (producer-for == null) logger;
|
||||||
serviceType = "longrun";
|
serviceType = "longrun";
|
||||||
run = serviceScript run;
|
run = serviceScript run;
|
||||||
finish = cleanupScript name;
|
finish = cleanupScript name finish;
|
||||||
producer-for = if producer-for != null then producer-for else "${name}-log";
|
producer-for = if producer-for != null then producer-for else "${name}-log";
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -82,7 +84,7 @@ let
|
|||||||
up = writeScript "${name}-up" (serviceScript up);
|
up = writeScript "${name}-up" (serviceScript up);
|
||||||
down = writeScript
|
down = writeScript
|
||||||
"${name}-down"
|
"${name}-down"
|
||||||
"${serviceScript down}\n${cleanupScript name}";
|
"${serviceScript down}\n${cleanupScript name null}";
|
||||||
});
|
});
|
||||||
bundle = { contents ? []
|
bundle = { contents ? []
|
||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
|
Loading…
Reference in New Issue
Block a user