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.
This commit is contained in:
parent
864965a29d
commit
b8d9886054
4 changed files with 27 additions and 2 deletions
|
@ -1,3 +1,6 @@
|
|||
if [[ "$UID" -gt 10000 ]] && [[ ! -f ~/.local/share/user-places.xbel.lmn ]] ; then
|
||||
(sleep 30 ; lmn-patch-dolphin.sh) &
|
||||
fi
|
||||
if [[ "$UID" -gt 10000 ]] && [[ -f ~/.local/share/user-places.xbel ]] ; then
|
||||
lmn-fixhome-dolphin.sh
|
||||
fi
|
||||
|
|
20
roles/lmn_fvs/files/lmn-fixhome-dolphin.sh
Normal file
20
roles/lmn_fvs/files/lmn-fixhome-dolphin.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/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
|
|
@ -16,11 +16,12 @@ fi
|
|||
id="$(grep ID "$file" | sed -E "s|^.+ID>([[:digit:]]+)/([[:digit:]]+)</ID.+$|\1:\2|" \
|
||||
| sort -n -t: -k2 | tail -1 )"
|
||||
|
||||
if id | grep teachers; then
|
||||
if id | grep -q teachers; then
|
||||
NETHOME=/srv/samba/schools/default-school/teachers/$USER
|
||||
else
|
||||
NETHOME=/srv/samba/schools/default-school/students/*/$USER
|
||||
NETHOME=(/srv/samba/schools/default-school/students/*/"$USER")
|
||||
fi
|
||||
[[ -d $NETHOME ]] || exit 0
|
||||
|
||||
IDENTITY="${id%%:*}"
|
||||
NUM0="${id##*:}"
|
||||
|
|
|
@ -184,6 +184,7 @@
|
|||
loop:
|
||||
- lmn-reset-dolphin.sh
|
||||
- lmn-patch-dolphin.sh
|
||||
- lmn-fixhome-dolphin.sh
|
||||
|
||||
- name: Configure KDE dolphin menu
|
||||
ansible.builtin.copy:
|
||||
|
|
Loading…
Add table
Reference in a new issue