this repo has no description
1#!/usr/bin/env bash
2
3VM=${1:-win10}
4GROUP=wheel
5
6# Relevant paths
7INCUS=/var/run/incus
8VMDIR=${INCUS}/${VM}
9SPICE=${INCUS}/${VM}/qemu.spice
10
11# First check if we have access to the shared memory device.
12#
13# Use udev rules to set permissions.
14# IVSHMEM=/dev/shm/looking-glass
15IVSHMEM=/dev/kvmfr0
16if ! [[ -r ${IVSHMEM} && -w ${IVSHMEM} ]]; then
17 ls -l ${IVSHMEM}
18 echo "need rw access to shared memory device ${IVSHMEM}"
19 exit 1
20fi
21
22# Iff necessary, grant read-execute on the incus run directory to
23# the group in ${GROUP}.
24if ! [[ -x ${INCUS} && -r ${INCUS} ]]; then
25 sudo chown :${GROUP} ${INCUS} && sudo chmod g=rx ${INCUS}
26fi
27
28# Iff necessary, grant read-execute on the vm directory, and
29# read-write on the spice socket, to the group in ${GROUP}.
30if ! [[ -x ${VMDIR} && -r ${VMDIR} && -r ${SPICE} && -w ${SPICE} ]]; then
31 sudo chown :${GROUP} ${VMDIR} && sudo chmod g=rx ${VMDIR}
32 sudo chown :${GROUP} ${SPICE} && sudo chmod g=rw ${SPICE}
33fi
34
35looking-glass-client -f ${IVSHMEM} -c ${SPICE} -p 0 win:size=2880x1620 win:title="Looking Glass @ $VM"