From b1816effdb2fa2c9d1fb90bcfb792c82405fba69 Mon Sep 17 00:00:00 2001 From: Raphael Dannecker Date: Mon, 4 Nov 2024 18:26:53 +0100 Subject: [PATCH] create a list of network drives that can be mounted in the VM Some Windows programs have problems with virtiofsd drives. So that the appropriate SMB shares can be mounted directly in Windows, a corresponding list of network drives is created before the VM starts. --- roles/lmn_vm/files/vm-run | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/roles/lmn_vm/files/vm-run b/roles/lmn_vm/files/vm-run index 43f6470..89e0542 100755 --- a/roles/lmn_vm/files/vm-run +++ b/roles/lmn_vm/files/vm-run @@ -118,6 +118,21 @@ create_printerlist() { done } +create_mountlist() { + if id | grep -q teachers; then + NETHOME=/srv/samba/schools/default-school/teachers/$USER + else + NETHOME=(/srv/samba/schools/default-school/students/*/"$USER") + fi + NETHOME="${NETHOME#/srv/samba/schools}" + cat << EOF > "/lmn/media/${USER}/.mounts.csv" +Drive;Remotepath +H;\\\\10.190.1.1${NETHOME//\//\\} +T;\\\\10.190.1.1\default-school\share +EOF + echo "${USER}" > "/lmn/media/${USER}/.user" +} + start_virtiofsd() { # BEGIN temporary fix, while linux-starter are not migrated to --uid and --gid if [[ "$LIBVIRTOSINFO" =~ debian.* ]]; then @@ -269,6 +284,8 @@ if ! virsh --connect="${QEMU}" list | grep "${VM_NAME}-clone"; then #trap exit_script SIGHUP SIGINT SIGTERM create_printerlist + create_mountlist + # start virtiofsd-service [[ "${QEMU}" = 'qemu:///session' ]] && start_virtiofsd