Rework printer setup.

Don't remove local printers.
Create printerlist.csv for VMs.
This commit is contained in:
Raphael Dannecker 2024-06-04 14:42:10 +02:00
parent 463997aa26
commit 679e0cc0aa
3 changed files with 17 additions and 8 deletions

View file

@ -105,6 +105,15 @@ create_clone() {
}
create_printerlist() {
## Prepare .printerlist.csv
mkdir -p "${VM_MEDIADIR}"
echo "Name;IppURL" > "${VM_MEDIADIR}/.printerlist.csv"
for p in $(lpstat -v | cut -f 3 -d" " | sed 's/:$//'); do
echo "$p;ipp://192.168.122.1/printers/$p" >> "${VM_MEDIADIR}/.printerlist.csv"
done
}
QEMU='qemu:///session'
NEWCLONE=0
@ -221,6 +230,7 @@ if ! virsh --connect="${QEMU}" list | grep "${VM_NAME}-clone"; then
virsh --connect=qemu:///session undefine "${VM_NAME}-clone" || echo "${VM_NAME}-clone did not exist"
#trap exit_script SIGHUP SIGINT SIGTERM
create_printerlist
# start virtiofsd-service
[[ "${QEMU}" = 'qemu:///session' ]] && sudo /usr/local/bin/vm-virtiofsd "${VM_NAME}"

View file

@ -15,3 +15,5 @@ else
VM_DIR="/tmp/${UID}/vm"
VM_DIR_PERSISTENT="/var/vm/${UID}"
fi
VM_MEDIADIR="/lmn/media/${USER}"