summary refs log tree commit diff
path: root/host/rootfs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-02-16 11:25:53 +0000
committerAlyssa Ross <hi@alyssa.is>2022-02-16 11:25:53 +0000
commitaeca199c52a6031a4c1d3380b5b2b25cb27ca352 (patch)
tree5fbd2603bc769d81a389803a05899752414fbf58 /host/rootfs
parent7829b664f4c63e806d0808a8a5087dfb4786c20e (diff)
downloadspectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar.gz
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar.bz2
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar.lz
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar.xz
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.tar.zst
spectrum-aeca199c52a6031a4c1d3380b5b2b25cb27ca352.zip
host/rootfs: add VM lifecycle management commands
Diffstat (limited to 'host/rootfs')
-rw-r--r--host/rootfs/Makefile5
-rwxr-xr-xhost/rootfs/usr/bin/lsvm17
-rwxr-xr-xhost/rootfs/usr/bin/vm-start6
-rwxr-xr-xhost/rootfs/usr/bin/vm-stop5
4 files changed, 32 insertions, 1 deletions
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index ef4c70a..4fe23d6 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -33,7 +33,10 @@ FILES = \
 	etc/service/getty-tty4/run \
 	etc/service/getty-ttyS0/run \
 	etc/xdg/weston/autolaunch \
-	etc/xdg/weston/weston.ini
+	etc/xdg/weston/weston.ini \
+	usr/bin/lsvm \
+	usr/bin/vm-start \
+	usr/bin/vm-stop
 
 # These are separate because they need to be included, but putting
 # them as make dependencies would confuse make.
diff --git a/host/rootfs/usr/bin/lsvm b/host/rootfs/usr/bin/lsvm
new file mode 100755
index 0000000..4f7cfcb
--- /dev/null
+++ b/host/rootfs/usr/bin/lsvm
@@ -0,0 +1,17 @@
+#!/bin/execlineb -P
+# SPDX-License-Identifier: EUPL-1.2
+# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+
+foreground { s6-rc -bu change ext }
+foreground { printf "NAME                \tSTATUS\n" }
+cd /ext/svc/data
+elglob -0 vms *
+forx -E vm { $vms }
+if { printf "%-20s\t" $vm }
+ifte {
+  ifte { echo "STOPPED" }
+  { echo "RUNNING" }
+  test -f /run/service/ext-${vm}-vmm/down
+}
+{ echo "UNKNOWN" }
+test -d /run/service/ext-${vm}-vmm
diff --git a/host/rootfs/usr/bin/vm-start b/host/rootfs/usr/bin/vm-start
new file mode 100755
index 0000000..763f301
--- /dev/null
+++ b/host/rootfs/usr/bin/vm-start
@@ -0,0 +1,6 @@
+#!/bin/execlineb -S1
+# SPDX-License-Identifier: EUPL-1.2
+# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+
+foreground { s6-rc -bu change ext-rc }
+s6-rc -l /run/s6-rc.ext -u change $1
diff --git a/host/rootfs/usr/bin/vm-stop b/host/rootfs/usr/bin/vm-stop
new file mode 100755
index 0000000..b39bc3b
--- /dev/null
+++ b/host/rootfs/usr/bin/vm-stop
@@ -0,0 +1,5 @@
+#!/bin/execlineb -S1
+# SPDX-License-Identifier: EUPL-1.2
+# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+
+s6-rc -l /run/s6-rc.ext -d change ${1}-vmm