#!/bin/execlineb -WP # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2025 Yureka Lilian # SPDX-FileCopyrightText: 2025 Alyssa Ross cgroup-setup --leaf spectrum-router importas -i VM VM s6-ipcserver-socketbinder -a 0770 /run/vm/by-id/${VM}/router-driver.sock fdmove -c 3 0 s6-ipcserver-socketbinder -a 0770 /run/router/${VM} fdmove -c 4 0 redirfd -r 0 /dev/null if { chown -- vmm-${VM} /run/vm/by-id/${VM}/router-driver.sock } if { chgrp -- vmm /run/router/${VM} } # Notify readiness. if { fdmove -c 5 1 echo } s6-setuidgid router bwrap --unshare-all --unshare-user --dev-bind / / --setenv RUST_LOG spectrum-router=debug,info --setenv LISTEN_FDS 2 --tmpfs /tmp --dev /dev --tmpfs /dev/shm --ro-bind /nix /nix --ro-bind /etc /etc --tmpfs /run --ro-bind /usr /usr --ro-bind /lib /lib --bind /run/vm/by-id/${VM} /run/vm/by-id/${VM} -- getpid LISTEN_PID spectrum-router