summaryrefslogtreecommitdiffstats
path: root/libkonq/favicons/move_favicons.sh
blob: a06d7d2bddb22b1d8665b375e467b36a29b0689a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh

prefix=$(kde-config --localprefix)
source1="$prefix/share/icons/favicons"
source2="$prefix/share/cache/favicons"
dest="$(kde-config --path cache)/favicons"

if [ -n "$prefix" -a -d "$source1" ]; then
	while [ ! -d "$dest" ]; do
		dir="$dest"
		while [ ! -d `dirname "$dir"` ]; do
			dir=`dirname "$dir"`
		done
		mkdir "$dir" || exit 1
	done

	icons=`ls "$source1" 2>/dev/null`
	if [ -n "$icons" ]; then
		for i in $icons; do
			mv -f "$source1/$i" "$dest/$i"
		done
	fi
	rmdir "$source1"
fi
if [ -n "$prefix" -a -d "$source2" ]; then
	while [ ! -d "$dest" ]; do
		dir="$dest"
		while [ ! -d `dirname "$dir"` ]; do
			dir=`dirname "$dir"`
		done
		mkdir "$dir" || exit 1
	done

	icons=`ls "$source2" 2>/dev/null`
	if [ -n "$icons" ]; then
		for i in $icons; do
			mv -f "$source2/$i" "$dest/$i"
		done
	fi
	rmdir "$source2"
fi