Merge Debian packaging for release “0.7.2-1”.
[debian_comixcursors.git] / install-all
bloba512aa0c550a5a3856227801b62ce44e68a6d0a5
1 #! /bin/bash
3 # install-all
4 # Part of ComixCursors, a desktop cursor theme.
6 # Copyright © 2010 Ben Finney <ben+gnome@benfinney.id.au>
7 # Copyright © 2006–2010 Jens Luetkens <j.luetkens@hamburg.de>
9 # This work is free software: you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # This work is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this work. If not, see <http://www.gnu.org/licenses/>.
22 # Build and install all the ComixCursors themes.
24 themename_stem="ComixCursors"
25 configfile_dir="${themename_stem}Configs"
26 configfile_template_name="custom"
28 bindir="$(dirname $0)"/bin
30 # Set the ICONSDIR destination to a default (if not already set).
31 ICONSDIR=${ICONSDIR:-~/.icons}
32 export ICONSDIR
34 # argument processing and usage
35 function show_usage_message {
36 cat <<_EOT_
37 Usage: $0 [option]
39 Install the ComixCursors mouse theme.
41 Options:
42 -h: Display this help text, then exit.
43 -u: Uninstall the ComixCursors mouse theme.
45 _EOT_
48 while getopts ":uh" opt; do
49 case $opt in
51 show_usage_message
52 exit
55 UNINSTALL=true
58 printf "Unexpected option: -%s\n" "$OPTARG" >&2
59 show_usage_message
60 exit 2
62 esac
63 done
65 function build_theme {
66 # Build the cursors for a particular theme.
67 THEMENAME="$1"
69 destdir="${ICONSDIR}/${themename_stem}-${THEMENAME}"
70 if [ -d "${destdir}" ] ; then
71 rm -r "${destdir}"
74 export THEMENAME
75 if [ $UNINSTALL ] ; then
76 make uninstall
77 else
78 printf "\nBuilding \"${THEMENAME}\":\n\n"
79 "${bindir}"/build-cursors
80 make
81 make install
85 for configfile in "${configfile_dir}"/*.CONFIG ; do
86 # Each config file represents a theme to be built.
87 configfile_name=$(basename "$configfile")
88 themename="${configfile_name%.CONFIG}"
89 if [ "$themename" == "$configfile_template_name" ] ; then
90 # The template isn't a theme we want to build.
91 continue
93 build_theme "$themename"
94 done