Improve printer installation on teacherlaptops

- Update printer list when connected via VPN
- Prevent printer removal, when logging in without a connection to the school network
This commit is contained in:
Raphael Dannecker 2024-09-08 11:27:24 +02:00
parent df50907006
commit 2c201e160e
2 changed files with 4 additions and 0 deletions

View file

@ -2,6 +2,9 @@
set -eu
## Exit if first printserver is not reachable
ping -c1 -W1 {{ printservers | first }} || exit 0
printservers="{{ printservers | join(' ') }}"
hostgroup="$(id -Gn "${HOSTNAME^^}$")"
usergroup="$(id -Gn "${SUDO_USER}")"

View file

@ -30,6 +30,7 @@ if [[ "$CONNECTION_ID" = "VPN-Schule" ]]; then
-o "sec=krb5i,cruid=${USERID},user=${USERNAME},uid=${USERID},gid=${GROUPID},file_mode=0700,dir_mode=0700,mfsymlinks,nobrl,actimeo=600,cache=loose,echo_interval=10"
echo "after mount" >&2
mount --bind /srv/samba/schools/default-school/share "/lmn/media/${USERNAME}/share"
SUDO_USER=$USERNAME /usr/local/bin/install-printers.sh
elif [[ "$NM_DISPATCHER_ACTION" = "pre-down" ]]; then
# FIXME: Only umount server when Wireguard-Connection was the only connection to server.
# Dirty fix (works only in fvs-IP-Range)