Skip to content

Commit 6928cbf

Browse files
committed
feat: add virtiofsd for dir passthrough
1 parent 0850141 commit 6928cbf

File tree

6 files changed

+1586
-0
lines changed

6 files changed

+1586
-0
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "shared-modules"]
22
path = shared-modules
33
url = https://github.com/flathub/shared-modules/
4+
[submodule "flatpak-builder-tools"]
5+
path = flatpak-builder-tools
6+
url = git@github.com:flatpak/flatpak-builder-tools.git

flatpak-builder-tools

Submodule flatpak-builder-tools added at aac65cf

org.virt_manager.virt_manager.Extension.Qemu.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ app-id: org.virt_manager.virt_manager.Extension.Qemu
22
runtime: org.virt_manager.virt-manager
33
runtime-version: stable
44
sdk: org.freedesktop.Sdk//24.08
5+
sdk-extensions:
6+
- org.freedesktop.Sdk.Extension.rust-stable
57
build-extension: true
68
separate-locales: false
79
build-options:
10+
append-path: /usr/lib/sdk/rust-stable/bin
811
prefix: /app/lib/extensions/Qemu
912
cflags: -I/app/lib/extensions/Qemu/include
1013
cxxflags: -I/app/lib/extensions/Qemu/include
@@ -48,6 +51,43 @@ modules:
4851
project-id: 13607
4952
url-template: https://download.qemu.org/qemu-9.2.0.tar.xz
5053
modules:
54+
- name: virtiofsd
55+
buildsystem: simple
56+
build-commands:
57+
# Updating the dependencies should be done via `update-deps.sh`
58+
- install -Dm0644 ./virtiofsd-cargo-config.toml .cargo/config
59+
- cargo --offline fetch --manifest-path Cargo.toml --verbose
60+
- cargo --offline build --release --verbose
61+
- install -Dm0755 ./target/release/virtiofsd ${FLATPAK_DEST}/bin/virtiofsd
62+
sources:
63+
- virtiofsd-cargo-sources.json
64+
- type: file
65+
path: virtiofsd-cargo-config.toml
66+
- type: archive
67+
url: https://gitlab.com/virtio-fs/virtiofsd/-/archive/v1.13.0/virtiofsd-v1.13.0.tar.gz
68+
sha256: a45f4b3661322587a06b6aa29e5353e0a7047e755e8a7f55dbae308b778eb41c
69+
x-checker-data:
70+
type: anitya
71+
project-id: 347345
72+
url-template: https://gitlab.com/virtio-fs/virtiofsd/-/archive/v$version/virtiofsd-v$version.tar.gz
73+
modules:
74+
- name: libcap-ng
75+
buildsystem: autotools
76+
config-opts:
77+
- --without-python3
78+
- --enable-static=no
79+
sources:
80+
- type: archive
81+
url: https://github.com/stevegrubb/libcap-ng/archive/v0.8.5.tar.gz
82+
sha256: e4be07fdd234f10b866433f224d183626003c65634ed0552b02e654a380244c2
83+
x-checker-data:
84+
type: anitya
85+
project-id: 1570
86+
stable-only: true
87+
url-template: https://github.com/stevegrubb/libcap-ng/archive/v$version.tar.gz
88+
cleanup:
89+
- /bin
90+
- /share/aclocal
5191
- name: slirp
5292
buildsystem: meson
5393
sources:

update-deps.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
TARGET_VERSION="${1:-1.13.0}"
6+
7+
LOCK_FILE_DIR=$(mktemp -d)
8+
cleanup() {
9+
rm -r "$LOCK_FILE_DIR"
10+
}
11+
trap cleanup EXIT
12+
set -x
13+
curl -s -L "https://gitlab.com/virtio-fs/virtiofsd/-/archive/v${TARGET_VERSION}/virtiofsd-v${TARGET_VERSION}.tar.gz" | tar xzf - -C "$LOCK_FILE_DIR"
14+
podman run --rm -it \
15+
-v .:/tmp/build:Z \
16+
-v "$LOCK_FILE_DIR:$LOCK_FILE_DIR:Z" \
17+
docker.io/library/python:3.12.8 \
18+
sh -c "pip install aiohttp toml && /tmp/build/flatpak-builder-tools/cargo/flatpak-cargo-generator.py ${LOCK_FILE_DIR}/virtiofsd-v${TARGET_VERSION}/Cargo.lock -o /tmp/build/virtiofsd-cargo-sources.json"

virtiofsd-cargo-config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[source.crates-io]
2+
replace-with = "vendored-sources"
3+
4+
[source.vendored-sources]
5+
directory = "cargo/vendor"
6+
7+
[build]
8+
rustflags = ["-L", "/app/lib/extensions/Qemu/lib"]

0 commit comments

Comments
 (0)