Annotation of /trunk/include/xdg.minc
Parent Directory | Revision Log
Revision 86 -
(hide annotations)
(download)
Fri Nov 7 08:59:46 2014 UTC (9 years, 5 months ago) by niro
File size: 922 byte(s)
Fri Nov 7 08:59:46 2014 UTC (9 years, 5 months ago) by niro
File size: 922 byte(s)
-use xdg-tools to update icon resources
1 | niro | 86 | # $Id$ |
2 | |||
3 | xdg_update_icon_resource() | ||
4 | { | ||
5 | local themes | ||
6 | |||
7 | if [[ ${MROOT} != / ]] && [[ ! -z ${MROOT} ]] | ||
8 | then | ||
9 | echo "Not updating icon cache in MROOT='${MROOT}'," | ||
10 | echo "you need to update it by yourself later" | ||
11 | return 0 | ||
12 | fi | ||
13 | |||
14 | if [ -x $(type -P xdg-icon-resource) ] | ||
15 | then | ||
16 | if [ -d ${BUILDDIR}/${PKGNAME}/binfiles/usr/share/icons ] | ||
17 | then | ||
18 | echo "Searching icon directories ..." | ||
19 | pushd ${BUILDDIR}/${PKGNAME}/binfiles &> /dev/null | ||
20 | themes=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d -printf '%f\n' 2> /dev/null) | ||
21 | popd &> /dev/null | ||
22 | else | ||
23 | themes="hicolor" | ||
24 | fi | ||
25 | |||
26 | # abort here, if no themes where found | ||
27 | [[ -z ${themes} ]] && return | ||
28 | |||
29 | echo "Updating xdg icon cache ..." | ||
30 | local i | ||
31 | for i in ${themes} | ||
32 | do | ||
33 | if [[ -f /usr/share/icons/${i}/index.theme ]] | ||
34 | then | ||
35 | xdg-icon-resource forceupdate --theme ${i} | ||
36 | fi | ||
37 | done | ||
38 | else | ||
39 | echo "xdg-icon-resource was not found, icon cache not updated" | ||
40 | fi | ||
41 | } |