Re: Using execline in place of shell for s6/s6-rc setup: environment variables?

2017-05-20 Thread Casper Ti. Vector
Something strange happened to my previous mail: the `SHA512SUMS.asc'
file only had one line saying `Version: 1'; perhaps a problem with mutt.
The correct version is now attached.

And I am very sorry for these spammy mails :(

On Sat, May 20, 2017 at 12:51:13PM +0800, Casper Ti. Vector wrote:
> Attached are their checksums (plus that for the `alpine-s6rc-conf'
> tarball) signed with my OpenPGP key.

-- 
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

5b47a73c88ba9b98786ffd23a11e0c185019cac3ee740b5c5d29b81d2fe745de99530c8027421ff3af1b282906d829a89914a594247204da187ec761c92f892e
  alpine-s6rc-conf.tgz
f30f206f9ae8db4ec3356a86ba4e64192c7608db38a95a3ea2ae546c47fee6ae1af3aadd7612abfa28702ff9bae0b6a3f9a3277e3153a14dbe801273c50f2d7b
  rc-1.7.4-x86_64.gz
f0621fb419c244101d5841a976477ab333787f74d282f8fd339e423cf2610479c79fbe36f8387cfcea3c2a5384781aa0e656424981e8b3f67114fec9c6512c75
  rc-1.7.4-x86.gz
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEE2RLoDKoyqvVE59qjgf3bVMjcwokFAlkfxggACgkQgf3bVMjc
wokcTA/+KybmGgrf3P9EFq2MiExRCdXtjeDZdmB7CjNa8HQgL8j4YRN24dlNhBVb
V5FXGV0fJwELwiltcW+jU65P8s4UzRclcaxZEdHZpgK++tod2c38r3iRUvE7vTu2
NKP2OimwVRozvJrxWX4a2vy2eIwzLrzbB8ALgKRAb4bz0tojpKt9pqD81RI43giY
VEhN/ZITiQkwq7gWvtqEnuK062CaDc+pIlakO70l2fg9T9arctUnpZpMwTmoufUN
oloTA8FgCNrJ2FNHhYVEMCYWLZ3N6Dy44AJ5QpKBxoO1ujAXEfmDBVwNCFPb1P1v
u39SdiSLCZi2GgyecM/MWfTmvF4WWVDhplRr6caubcWYvvyMyaE+NFg+PREoP/4l
X4Fqef92wuBntMAvOKgz78AKvAF168ERieVKv5xECNiUsfn05NWHJI8MzA1JMFiT
l4ZiAUSrn84kVturKi9vqHiOLzFZ4EhcjOu24kHU0j65SegK6cTeK10CoKgT8Ly5
J3guRnPj5n7HvAiQpcpC74nc+u7YaiYBwXok+y7eIIhDM4eXKOCBxSIjT//i7N14
NGRQtjRjwXf+CBRFsMNA/hIVJm3RqT4AfDbh4kCzjEMSL7v9I3xyc2n7FFjUzqhF
3mKmIbz3caTxoDu903PgjKPROObSSZLaZ4LyPdf7d0idmRQui7E=
=zdQc
-END PGP SIGNATURE-


Re: Using execline in place of shell for s6/s6-rc setup: environment variables?

2017-05-19 Thread Casper Ti. Vector
:(

On Sat, May 20, 2017 at 12:51:13PM +0800, Casper Ti. Vector wrote:
> Attached are their checksums (plus that for the `alpine-s6rc-conf'
> tarball) signed with my OpenPGP key.

-- 
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C



SHA512SUMS.asc
Description: application/pgp-encrypted


Re: Using execline in place of shell for s6/s6-rc setup: environment variables?

2017-05-19 Thread Casper Ti. Vector
Which would require rc(1), but it is unfortunately "unmaintained" in
Alpine.  Following are static-compiled binaries for the 1.7.4 version:
x86_64: 
x86: 

Attached are their checksums (plus that for the `alpine-s6rc-conf'
tarball) signed with my OpenPGP key.

On Sat, May 20, 2017 at 12:20:30PM +0800, Casper Ti. Vector wrote:
> follow the README in the tarball

-- 
My current OpenPGP key:
RSA4096/0x227E8CAAB7AA186C (expires: 2020.10.19)
7077 7781 B859 5166 AE07 0286 227E 8CAA B7AA 186C



Re: Using execline in place of shell for s6/s6-rc setup: environment variables?

2017-05-19 Thread Laurent Bercot
I am trying to determine whether is feasible and sane for me to try to 
port
Slackware's init scripts that initialize such things as filesystems, 
kernel

modules, network interfaces, etc. I would be trying to write these in
execline as oneshot services to be started by s6-rc at the very 
beginning

of the dependency tree.


 It's certainly feasible. Whether it is desirable, or sane, is another
question entirely. :)

 First, note that you don't have to convert a script to execline in 
order

to use it as a s6-rc oneshot. You can, for instance, have a sysvrc-style
shell script in /etc/init.d/foobar, and build your s6-rc foobar service
with "/etc/init.d/foobar start" in foobar/up and "/etc/init.d/foobar 
stop"

in foobar/down.
 Or you can even directly write: /bin/sh -c "my shell script"
in an up or down file for s6-rc, if you're mastering the execline 
quoting

enough to write a whole shell script execline-quoted this way.

 Second, be aware that using execline is actually beneficial over using
a shell in very simple scripts, especially scripts involving large
amounts of chain loading - such as s6 run scripts, for instance; but for
more complex scripts with control structures or advanced features,
it's very possible that you gain nothing. So, conversion of a shell
script to execline is an excellent exercise in learning execline, but
past a certain point it doesn't necessarily have intrinsic value. RC
scripts are kind of on the edge - some of them can be easily translated
to execline for speed gains, and for others it's just not worth it.

 Third, converting rc scripts from a distribution to a s6-rc service
database is currently the *most valuable contribution* you can do for
s6-rc. I'm not joking: what s6 and s6-rc need right now is adoption
by mainstream distribution, and the limiting factor is clearly the
conversion from sysvrc or OpenRC scripts to the s6-rc source format.
So if you're going to attempt this for Slackware, you have my whole
support, and my thanks; but this is a large task, and does not need
extra porting work piled onto it. If you can do that, it will be a
big, and useful, achievement, even if the scripts are still shell
scripts.

 So, my overall advice is to just not try translating the rc scripts
to execline - at least as a first step - and focus on the conversion to
the s6-rc source format instead. If, during that conversion, you notice
certain simple scripts that would clearly benefit from being rewritten
in execline instead of shell, then why not - but I definitely wouldn't
make this a primary goal.

 Now to answer your question:

The problem I am anticipating is that with execline, it seems as though 
I

will not have access to any of the shell environment variables that
Slackware uses heavily for its rc scripts. Since my (admittedly insane)
goal is to provide a drop-in replacement for all Slackware rc scripts, 
I

would need some way to replicate these variables or keep them intact.


 Indeed, execline provides no shell variables since there is no resident
interpreter. The idiomatic way of reading information for an execline
script is to store that information in an envdir, and read it at the
start of the script via s6-envdir, which will put the information into
environment variables:
 http://skarnet.org/software/s6/s6-envdir.html

 If you cannot convert the information to an envdir format and are stuck
with a series of "key=value" instructions read from a shell, you can
simply write a small shell script, "read-env", that reads those
instructions, exports all the relevant keys to the environment, then
execs into the rest of its command line. read-env then becomes a
command that behaves like s6-envdir, but for shell-format files; and
you can integrate this command in your execline scripts.

 If you need support for the Slackware rc scripts conversion, I 
recommend

you join #s6 on Freenode - we are *very* interested in that work and
you'll likely always find someone who's ready to assist you. (Of course,
the mailing-lists are good too!)

--
 Laurent