lmn-client/roles/lmn_fvs/files/lmn-fixhome-dolphin.sh
Raphael Dannecker b8d9886054 Fix dolphin places config (user-places.xbel)
Existing dolphin configs can be incorrect for two reasons:
- Instead of the class identifier, a * was incorrectly entered in the home@server URL.
- If the student has changed classes, the old class name is still in the home URL.

lmn-patch-dolphin.sh no longer enters a * in the home@server URL.
lmn-fixhome-dolphin.sh will fix existing configs.
2024-10-31 17:28:16 +01:00

20 lines
460 B
Bash

#!/usr/bin/bash
set -eu
file="${1:-$HOME/.local/share/user-places.xbel}"
[[ -e "$file" ]] || exit 0
if id | grep -q teachers; then
exit 0
fi
NETHOME=(/srv/samba/schools/default-school/students/*/"$USER")
[[ -d $NETHOME ]] || exit 0
if FOUND=$(grep -o "/srv/samba/schools/default-school/students/.*/$USER" $file); then
if [[ "$NETHOME" != "$FOUND" ]] ; then
sed -i "s|/srv/samba/schools/default-school/students/.*/$USER|$NETHOME|g" $file
fi
fi