#!/bin/execlineb -Ws0 # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2022-2023, 2025 Alyssa Ross # SPDX-FileCopyrightText: 2025 Demi Marie Obenour if { case "${#}" { 1 { true } 2 { multisubstitute { define sourcedir ${2} define fsdir /run/vm/by-id/${1}/fs/user } if { mkdir -p ${fsdir} } foreground { redirfd -w 2 /dev/null umount ${fsdir} } mount --bind -- ${sourcedir} ${fsdir} } } foreground { fdmove -c 1 2 echo "Bad number of arguments ${#} (expected 1 or 3)" } exit 100 } foreground { s6-rc -bu change vm-env } foreground { redirfd -w 2 /dev/null cd /run/vm/by-id/${1}/config/providers/net elglob -0 providers * forx -pE provider { $providers } backtick -E provider_id { backtick -E id_path { readlink /run/vm/by-name/${provider} } basename -- $id_path } vm-start $provider_id } foreground { redirfd -w 2 /dev/null s6-svwait -U /run/service/vmm/instance/${1} } if { ch-remote --api-socket /run/vm/by-id/${1}/vmm boot } case "${#}" { 2 { s6-svwait -D /run/service/vmm/instance/${1} } }