| 1 |
#! /bin/sh |
| 2 |
# Pre-install script for ‘@PACKAGE@’. |
| 3 |
# |
| 4 |
# Manpage: ‘dh_installdeb(1)’ |
| 5 |
|
| 6 |
set -e |
| 7 |
|
| 8 |
# Summary of ways this script can be called: |
| 9 |
# * <new-preinst> install |
| 10 |
# * <new-preinst> install <old-version> |
| 11 |
# * <new-preinst> upgrade <old-version> |
| 12 |
# * <old-preinst> abort-upgrade <new-version> |
| 13 |
# For details, see the Debian Policy §6.5 in the ‘debian-policy’ package |
| 14 |
# or on the web at <URL:http://www.debian.org/doc/debian-policy/>. |
| 15 |
|
| 16 |
action="$1" |
| 17 |
|
| 18 |
# All of the size-specific themes are removed in version 0.8. |
| 19 |
REMOVED_LIST=$( |
| 20 |
for colour in Black Blue Green Orange Red White ; do |
| 21 |
color_suffix="-$colour" |
| 22 |
for size in Huge Large Regular Small ; do |
| 23 |
size_suffix="-$size" |
| 24 |
for width_suffix in "" "-Slim" ; do |
| 25 |
printf "ComixCursors%s%s%s\n" \ |
| 26 |
"$color_suffix" "$size_suffix" "$width_suffix" |
| 27 |
done |
| 28 |
done |
| 29 |
done) |
| 30 |
ICONDIR=/usr/share/icons |
| 31 |
ALTERNATIVE_NAME=x-cursor-theme |
| 32 |
|
| 33 |
remove_omitted_alternatives () { |
| 34 |
# Remove themes installed by previous versions but omitted |
| 35 |
# from this version of the package. |
| 36 |
|
| 37 |
list_alternatives_cmd="update-alternatives --list $ALTERNATIVE_NAME" |
| 38 |
|
| 39 |
# We need to test this explicitly to avoid exiting with an error when |
| 40 |
# listing the alternatives. |
| 41 |
if ! ( $list_alternatives_cmd > /dev/null 2>&1 ) ; then |
| 42 |
# No alternatives installed, so we're done. |
| 43 |
return |
| 44 |
fi |
| 45 |
|
| 46 |
installed_cursor_themes=`$list_alternatives_cmd` |
| 47 |
for theme in $REMOVED_LIST ; do |
| 48 |
theme_dir="${ICONDIR}/${theme}" |
| 49 |
theme_file="${theme_dir}/index.theme" |
| 50 |
if printf "$installed_cursor_themes" | grep -q "${theme_file}" ; then |
| 51 |
update-alternatives --remove $ALTERNATIVE_NAME "${theme_file}" |
| 52 |
rm -f "${theme_dir}" |
| 53 |
fi |
| 54 |
done |
| 55 |
} |
| 56 |
|
| 57 |
case "$action" in |
| 58 |
upgrade) |
| 59 |
remove_omitted_alternatives |
| 60 |
;; |
| 61 |
|
| 62 |
install|abort-upgrade) |
| 63 |
;; |
| 64 |
|
| 65 |
*) |
| 66 |
printf "preinst called with unknown action ‘%s’\n" "$action" >&2 |
| 67 |
exit 1 |
| 68 |
;; |
| 69 |
|
| 70 |
esac |
| 71 |
|
| 72 |
# ‘dh_installdeb’ will replace this with shell code automatically generated |
| 73 |
# by other debhelper scripts. |
| 74 |
|
| 75 |
#DEBHELPER# |
| 76 |
|
| 77 |
exit 0 |