diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-10-10 23:28:43 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-02-26 15:59:47 +0000 |
commit | 62d05c9a2d5fdad8f18a12cea42d215c1c9f269a (patch) | |
tree | 5b034820ba3e8d17becaf61fb5647dcd61493131 /host/rootfs | |
parent | 3664233d0f702e7f1c8ba0ae939e097735f87714 (diff) | |
download | spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar.gz spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar.bz2 spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar.lz spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar.xz spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.tar.zst spectrum-62d05c9a2d5fdad8f18a12cea42d215c1c9f269a.zip |
host/rootfs: generate virtiofsd services
The approach of having a template service for each virtiofsd comes from the work I need on Wayland support for Unikie, hence the Unikie copyright in etc/s6-rc/ext-rc-init/up. Signed-off-by: Alyssa Ross <hi@alyssa.is> Message-Id: <20221010232909.1953738-4-hi@alyssa.is>
Diffstat (limited to 'host/rootfs')
-rw-r--r-- | host/rootfs/Makefile | 3 | ||||
-rw-r--r-- | host/rootfs/default.nix | 4 | ||||
-rw-r--r-- | host/rootfs/etc/s6-rc/ext-rc-init/up | 11 | ||||
-rw-r--r-- | host/rootfs/etc/template/fs/notification-fd | 1 | ||||
-rw-r--r-- | host/rootfs/etc/template/fs/notification-fd.license | 2 | ||||
-rwxr-xr-x | host/rootfs/etc/template/fs/run | 11 | ||||
-rw-r--r-- | host/rootfs/etc/template/fs/type | 1 | ||||
-rw-r--r-- | host/rootfs/etc/template/fs/type.license | 2 |
8 files changed, 33 insertions, 2 deletions
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index f4b17a0..39911eb 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -16,6 +16,9 @@ FILES = \ etc/mdev/wait \ etc/parse-devname \ etc/passwd \ + etc/template/fs/notification-fd \ + etc/template/fs/run \ + etc/template/fs/type \ etc/s6-linux-init/run-image/service/getty-tty1/run \ etc/s6-linux-init/run-image/service/getty-tty2/run \ etc/s6-linux-init/run-image/service/getty-tty3/run \ diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index 95bb3a8..9f1d426 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -8,7 +8,7 @@ pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4 , busybox, cloud-hypervisor, cryptsetup, execline, e2fsprogs, jq, kmod -, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, xorg +, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, virtiofsd, xorg }: let @@ -50,7 +50,7 @@ let packages = [ cloud-hypervisor e2fsprogs execline jq kmod mdevd s6 s6-linux-init s6-rc - socat start-vm + socat start-vm virtiofsd (cryptsetup.override { programs = { diff --git a/host/rootfs/etc/s6-rc/ext-rc-init/up b/host/rootfs/etc/s6-rc/ext-rc-init/up index 1aec7fb..53ab127 100644 --- a/host/rootfs/etc/s6-rc/ext-rc-init/up +++ b/host/rootfs/etc/s6-rc/ext-rc-init/up @@ -1,5 +1,6 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> +# SPDX-FileCopyrightText: 2022 Unikie if { mkdir -p /run/s6-rc.ext.src } @@ -15,6 +16,16 @@ if { if { redirfd -w 1 ${name}/notification-fd echo 3 } if { ln -s -- /bin/start-vm ${name}/run } + if { + elglob -0 paths ${dir}/shared-dirs/* + forx -pE path { $paths } + backtick -E fsname { basename -- $path } + if { cp -R -- /etc/template/fs ${name}-fs-${fsname} } + if { mkdir -- ${name}-fs-${fsname}/data ${name}-fs-${fsname}/env } + if { cp -P -- ${path}/dir ${name}-fs-${fsname}/data/shared-dir } + touch -- ${name}/dependencies.d/${name}-fs-${fsname} + } + elglob -0 paths /ext/svc/data/${name}/providers/net/* forx -pE path { $paths } backtick -E dep { basename -- $path } diff --git a/host/rootfs/etc/template/fs/notification-fd b/host/rootfs/etc/template/fs/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/host/rootfs/etc/template/fs/notification-fd @@ -0,0 +1 @@ +3 diff --git a/host/rootfs/etc/template/fs/notification-fd.license b/host/rootfs/etc/template/fs/notification-fd.license new file mode 100644 index 0000000..5a40633 --- /dev/null +++ b/host/rootfs/etc/template/fs/notification-fd.license @@ -0,0 +1,2 @@ +SPDX-License-Identifier: CC0-1.0 +SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is> diff --git a/host/rootfs/etc/template/fs/run b/host/rootfs/etc/template/fs/run new file mode 100755 index 0000000..5ca214a --- /dev/null +++ b/host/rootfs/etc/template/fs/run @@ -0,0 +1,11 @@ +#!/bin/execlineb -P +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> + +s6-ipcserver-socketbinder -a 0700 -B env/virtiofsd.sock + +if { fdmove 1 3 echo } +fdclose 3 + +export TMPDIR /run +virtiofsd --fd 0 --shared-dir data/shared-dir diff --git a/host/rootfs/etc/template/fs/type b/host/rootfs/etc/template/fs/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/host/rootfs/etc/template/fs/type @@ -0,0 +1 @@ +longrun diff --git a/host/rootfs/etc/template/fs/type.license b/host/rootfs/etc/template/fs/type.license new file mode 100644 index 0000000..5a40633 --- /dev/null +++ b/host/rootfs/etc/template/fs/type.license @@ -0,0 +1,2 @@ +SPDX-License-Identifier: CC0-1.0 +SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is> |