binfmt_misc: example systemd service file

This commit is contained in:
Julius Michaelis
2021-08-01 12:35:32 +09:00
parent 0c8f4d13b2
commit 1a6acfac7d
3 changed files with 24 additions and 0 deletions

View File

@ -46,3 +46,9 @@
* `libwasmer-static`, containing `libwasmer.a`.
The Wasmer distro packaging story is still in its infancy, so feedback is very welcome.
## Miscellaneous: binfmt_misc
Wasmer can be registered as a binfmt interpreter for wasm binaries.
An example systemd [.service](./scripts/wasmer-binfmt.service.example) is included here.
Please consider statically linking the wasmer binary so that this capability is also available in mount namespaces.

View File

@ -19,6 +19,9 @@ enum Action {
}
/// Unregister and/or register wasmer as binfmt interpreter
///
/// Check the wasmer repository for a systemd service definition example
/// to automate the process at start-up.
#[derive(StructOpt)]
pub struct Binfmt {
// Might be better to traverse the mount list

View File

@ -0,0 +1,15 @@
[Unit]
Description=Set up wasmer to handle execution of wasm binaries
DefaultDependencies=no
Conflicts=shutdown.target
After=proc-sys-fs-binfmt_misc.automount
After=proc-sys-fs-binfmt_misc.mount
Before=sysinit.target shutdown.target
ConditionPathIsReadWrite=/proc/sys/
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wasmer binfmt reregister
ExecStop=/usr/bin/wasmer binfmt unregister
TimeoutSec=10s