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.
This commit is contained in:
Raphael Dannecker 2024-11-04 18:26:53 +01:00
parent b8d9886054
commit b1816effdb

View file

@ -118,6 +118,21 @@ create_printerlist() {
done 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() { start_virtiofsd() {
# BEGIN temporary fix, while linux-starter are not migrated to --uid and --gid # BEGIN temporary fix, while linux-starter are not migrated to --uid and --gid
if [[ "$LIBVIRTOSINFO" =~ debian.* ]]; then if [[ "$LIBVIRTOSINFO" =~ debian.* ]]; then
@ -269,6 +284,8 @@ if ! virsh --connect="${QEMU}" list | grep "${VM_NAME}-clone"; then
#trap exit_script SIGHUP SIGINT SIGTERM #trap exit_script SIGHUP SIGINT SIGTERM
create_printerlist create_printerlist
create_mountlist
# start virtiofsd-service # start virtiofsd-service
[[ "${QEMU}" = 'qemu:///session' ]] && start_virtiofsd [[ "${QEMU}" = 'qemu:///session' ]] && start_virtiofsd