#!/bin/sh # # RPM filetrigger for kde5 preview plugins. # # Copyright (C) 2021 Artem Proskurnev # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. mf='/usr/share/kf5/plasma/plasmoids/org.kde.desktopcontainment/contents/config/main.xml' if egrep -qs $mf; then if [ -f $mf ]; then cat $mf > /tmp/main.xml f="/tmp/main.xml" g="/tmp/group.xml" t="/tmp/tempmain.xml" gstart=$(cat $f | grep -n "" | egrep -o "^[0-9]+") awk "NR>=$gstart && NR<=$gend" $f > $g awk "NR<$gstart" $f > $t xmlstarlet edit -u "/group/entry[@name='previewPlugins']/default" -v "audiothumbnail,ffmpegthumbs,imagethumbnail,exrthumbnail,jpegthumbnail,windowsimagethumbnail,svgthumbnail,windowsexethumbnail,comicbookthumbnail,directorythumbnail,fontthumbnail,blenderthumbnail,rawthumbnail,ebookthumbnail" $g | awk "NR>1" >> $t awk "NR>$gend" $f >> $t sed -i "s//<\/default>/g" $t mv -f $t $mf fi fi