You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kometa-std-desktop/kometa-std-desktop-1.3/previewplugins.filetrigger

34 lines
1.2 KiB

#!/bin/sh
#
# RPM filetrigger for kde5 preview plugins.
#
# Copyright (C) 2021 Artem Proskurnev <tema@proskurnevs.ru>
#
# 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 "<group" | egrep -o "^[0-9]+")
gend=$(cat $f | grep -n "</group>" | 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
mv -f $t $mf
fi
fi