source: lliurex-dgti-defaults-configs/trunk/fuentes/debian/postinst @ 6181

Last change on this file since 6181 was 6181, checked in by kbut, 3 years ago

add diversions

File size: 2.2 KB
Line 
1#!/bin/sh
2# postinst script for lliurex-dgti-defaults-configs
3#
4# see: dh_installdeb(1)
5
6set -e
7
8# summary of how this script can be called:
9#        * <postinst> `configure' <most-recently-configured-version>
10#        * <old-postinst> `abort-upgrade' <new version>
11#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
12#          <new-version>
13#        * <postinst> `abort-remove'
14#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15#          <failed-install-package> <version> `removing'
16#          <conflicting-package> <version>
17# for details, see https://www.debian.org/doc/debian-policy/ or
18# the debian-policy package
19
20package='lliurex-dgti-defaults-configs'
21
22divert_file()
23{
24    file=$1
25    theirfile=$2
26    if ! LC_ALL=C dpkg-divert --list "$package" | \
27        grep -xFq "diversion of $file to $theirfile by $package"; then
28        dpkg-divert --divert "$theirfile" --rename --package "$package" --add "$file"
29    fi
30}
31
32
33case "$1" in
34    configure | abort-remove )
35        divert_file /usr/bin/firefox /usr/bin/firefox-last
36        divert_file /usr/share/applications/firefox-esr.desktop /usr/share/applications/firefox-esr.desktop.diverted
37        if [ ! -e '/usr/bin/firefox' ]; then
38                ln -s /opt/firefox-esr/firefox /usr/bin/firefox
39        fi
40        alternative=$(readlink -f /etc/alternatives/java)
41        oracle_value='/usr/lib/jvm/java-8-oracle/jre/bin/java'
42        if [ '$alternative' != $oracle_value ]; then
43                update-alternative --set java $oracle_value
44        fi
45        alternative=$(readlink -f /etc/alternatives/mozilla-javaplugin.so)
46        oracle_value='/usr/lib/jvm/java-8-oracle/jre/lib/amd64/libnpjp2.so'
47        if [ '$alternative' != $oracle_value ]; then
48                update-alternative --set mozilla-javaplugin.so $oracle_value
49        fi
50        alternative=$(readlink -f /etc/alternatives/javaws)
51        oracle_value='/usr/lib/jvm/java-8-oracle/jre/bin/javaws'
52        if [ '$alternative' != $oracle_value ]; then
53                update-alternative --set javaws $oracle_value
54        fi
55    ;;
56
57    abort-upgrade|abort-deconfigure)
58    ;;
59
60    *)
61        echo "postinst called with unknown argument \`$1'" >&2
62        exit 1
63    ;;
64esac
65
66# dh_installdeb will replace this with shell code automatically
67# generated by other debhelper scripts.
68
69#DEBHELPER#
70
71exit 0
Note: See TracBrowser for help on using the repository browser.