Add sidebus integration
This commit is contained in:
parent
030503f23b
commit
9f0f835fce
6 changed files with 152 additions and 13 deletions
35
munix
35
munix
|
|
@ -131,10 +131,37 @@ else
|
|||
unset DISPLAY XAUTHORITY
|
||||
fi
|
||||
|
||||
exec bwrap --unshare-all --share-net \
|
||||
declare -a BG_PIDS
|
||||
|
||||
cleanup() {
|
||||
for pid in "${BG_PIDS[@]}"; do
|
||||
if kill -0 "$pid" 2>/dev/null; then
|
||||
echo "Killing process $pid"
|
||||
kill -INT "$pid"
|
||||
wait "$pid" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
exit
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
HOST_RUNTIME_DIR="$XDG_RUNTIME_DIR/munix.$$"
|
||||
mkdir -p $HOST_RUNTIME_DIR
|
||||
rm $HOST_RUNTIME_DIR/*
|
||||
sidebus-broker --guest-mountpoint /mnt/munix-doc-portal/doc --runtime-dir "$HOST_RUNTIME_DIR" --unix-path "$HOST_RUNTIME_DIR/port.sock" >/dev/null 2>&1 &
|
||||
BG_PIDS+=("$!")
|
||||
while [ ! -S "$HOST_RUNTIME_DIR/port.sock" ]; do sleep 0.1; done
|
||||
BWRAP_ARGS+=(
|
||||
--bind "$HOST_RUNTIME_DIR" /mnt/munix-doc-portal
|
||||
--bind "$HOST_RUNTIME_DIR/port.sock" "$XDG_RUNTIME_DIR/krun/socket/port-50000"
|
||||
)
|
||||
|
||||
# do not 'exec' because of cleanup :)
|
||||
bwrap --unshare-all --share-net \
|
||||
--uid $MICROVM_UID --gid $MICROVM_GID \
|
||||
--tmpfs / \
|
||||
--dir /run --dir /var --symlink /run /var/run --dir /tmp \
|
||||
--dir /run --dir /var --symlink /run /var/run --dir /tmp --dir /mnt \
|
||||
--proc /proc --ro-bind /sys /sys \
|
||||
--dev /dev --dir /dev/input --dev-bind /dev/kvm /dev/kvm \
|
||||
--ro-bind "$MUVM_PATH" /run/munix/muvm \
|
||||
|
|
@ -152,7 +179,7 @@ exec bwrap --unshare-all --share-net \
|
|||
--setenv PATH "/run/munix/muvm:/run/munix/passt:$MICROVM_CLOSURE/sw/bin" \
|
||||
"${BWRAP_ARGS[@]}" \
|
||||
muvm \
|
||||
--custom-init-cmdline "$MICROVM_CLOSURE/sw/sbin/init --log-target=console" \
|
||||
--custom-init-cmdline "$MICROVM_CLOSURE/sw/sbin/init --log-target=console systemd.set_credential=sidebus.port:50000" \
|
||||
"${MUVM_ARGS[@]}" \
|
||||
-e container=munix \
|
||||
-e MICROVM_CLOSURE="$MICROVM_CLOSURE" \
|
||||
|
|
@ -169,5 +196,3 @@ nogroup:x:65534:
|
|||
EOF
|
||||
) \
|
||||
13< /etc/resolv.conf
|
||||
|
||||
# --log-level=debug
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue