Adding debian version 0.4.0-1.
[debian/lxappearance.git] / scripts / install-icon-theme.sh
1 #!/bin/sh
2 # Script used to install new icon theme.
3 # Copyright (C) 2008 paulliu, pcman
4 # License: GNU GPL
5
6 # test argc
7 if (test $# -ne 1)
8 then
9 echo Usage: $0 compressed_file
10 exit
11 fi
12
13 # make temp dir
14 TMPDIR=`mktemp -d /tmp/icon-theme-XXXXXXX`
15
16 # decompress
17 if [ `basename -- $1 .tar.gz` != $1 ]
18 then
19 tar -C $TMPDIR -xzf $1
20 elif [ `basename -- $1 .tar.bz2` != $1 ]
21 then
22 tar -C $TMPDIR -xjf $1
23 fi
24
25 # create destdir
26 if [ -z "$XDG_DATA_HOME" ]
27 then
28 export XDG_DATA_HOME="$HOME/.local/share";
29 fi
30 THEME_DIR="$XDG_DATA_HOME/icons"
31 mkdir -p "$THEME_DIR"
32
33 # install
34 cd $TMPDIR
35 DLIST=`find -name 'index.theme' -exec dirname {} \;`
36 for DIR in $DLIST
37 do
38 basename "$DIR"
39 mv -f "$DIR" "$THEME_DIR"
40 done
41
42 # clear temp dir
43 rm -rf $TMPDIR