Make playbook more general: Split into general and specific roles, use variables.
This commit is contained in:
parent
c59fb67ed0
commit
431acebfa3
13 changed files with 247 additions and 144 deletions
61
roles/lmn_fvs/files/lmn-patch-dolphin.sh
Executable file
61
roles/lmn_fvs/files/lmn-patch-dolphin.sh
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# patch 'Tausch' and 'Nextcloud' into dolphin's bookmarks
|
||||
#
|
||||
set -eu
|
||||
|
||||
file="${1:-$HOME/.local/share/user-places.xbel}"
|
||||
|
||||
if grep -q "Tausch\|Nextcloud" "$file" ; then
|
||||
echo "Your Dolphin seems to already contain 'Tausch' and/or 'Nextcloud'."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
id="$(grep ID "$file" | sed -E "s|^.+ID>([[:digit:]]+)/([[:digit:]]+)</ID.+$|\1:\2|" \
|
||||
| sort -n -t: -k2 | tail -1 )"
|
||||
|
||||
IDENTITY="${id%%:*}"
|
||||
NUM0="${id##*:}"
|
||||
NUM1=$(( NUM0 + 1 ))
|
||||
NUM2=$(( NUM0 + 2 ))
|
||||
|
||||
patch="
|
||||
--- a/$file
|
||||
+++ b/$file
|
||||
@@ -98,9 +98,33 @@
|
||||
<isSystemItem>true</isSystemItem>
|
||||
</metadata>
|
||||
</info>
|
||||
</bookmark>
|
||||
+ <bookmark href=\"file:///srv/samba/schools/default-school/share\">
|
||||
+ <title>Tausch</title>
|
||||
+ <info>
|
||||
+ <metadata owner=\"http://freedesktop.org\">
|
||||
+ <bookmark:icon name=\"folder-publicshare\"/>
|
||||
+ </metadata>
|
||||
+ <metadata owner=\"http://www.kde.org\">
|
||||
+ <ID>$IDENTITY/${NUM1}</ID>
|
||||
+ <isSystemItem>true</isSystemItem>
|
||||
+ </metadata>
|
||||
+ </info>
|
||||
+ </bookmark>
|
||||
+ <bookmark href=\"file:///lmn/media/$USER/nextcloud\">
|
||||
+ <title>Nextcloud</title>
|
||||
+ <info>
|
||||
+ <metadata owner=\"http://freedesktop.org\">
|
||||
+ <bookmark:icon name=\"folder-cloud\"/>
|
||||
+ </metadata>
|
||||
+ <metadata owner=\"http://www.kde.org\">
|
||||
+ <ID>$IDENTITY/${NUM2}</ID>
|
||||
+ <isSystemItem>true</isSystemItem>
|
||||
+ </metadata>
|
||||
+ </info>
|
||||
+ </bookmark>
|
||||
<bookmark href=\"remote:/\">
|
||||
<title>Network</title>
|
||||
<info>
|
||||
<metadata owner=\"http://freedesktop.org\">
|
||||
<bookmark:icon name=\"folder-network\"/>
|
||||
"
|
||||
|
||||
echo "$patch" | patch --fuzz=0 --backup "$file"
|
Loading…
Add table
Add a link
Reference in a new issue