>#!/usr/lib/execline/bin/execlineb -P
>foreground {
> backtick -i file_loc {
> fdmove -c 2 1 xmlstarlet sel -t -v //File/Path /etc/some-config.xml
> }
> importas -iu file_loc file_loc
> if -n { test -e $file_loc }
> create-file
>}
>/usr/bin/s6-svscan /service
LGTM. As an addition, if you use execline-2.8.* then the -i option
to backtick is the default behaviour, and there is a -E option to
perform the 'importas' part automatically, so the script could become:
#!/usr/lib/execline/bin/execlineb -P
foreground {
backtick -E file_loc {
fdmove -c 2 1 xmlstarlet sel -t -v //File/Path /etc/some-config.xml
}
if -n { test -e $file_loc }
create-file
}
/usr/bin/s6-svscan /service
You could also add "unexport ?" between the foreground block and
the s6-svscan execution, to ensure the ? environment variable
added by foreground does not spill into the whole supervision tree.
As another note, "foreground", "backtick", and "fdmove" need to be
in the caller's PATH in order to be found. If your execlineb binary
is in /usr/lib/execline/bin/execlineb, then chances are the other
binaries are as well, so you should make sure /usr/lib/execline/bin
is in your PATH prior to running this script. As far as I know,
only Debian and Ubuntu install execline there; if you're using the
Debian or Ubuntu packages, /usr/bin/execlineb is a wrapper that adds
/usr/lib/execline/bin to your PATH then execs into the real execlineb;
so you should use the #!/usr/bin/execlineb shebang.
(I do not condone the Debian package's way of installing execline,
but they found a way to make it work without breaking the other
skarnet.org packages, so it's all I can ask for and the rest is
their policy to decide on.)
--
Laurent
Received on Tue Feb 23 2021 - 11:31:24 UTC