File: JB-bin.postinst.in

package info (click to toggle)
sun-java6 6-26-0lenny1
  • links: PTS, VCS
  • area: non-free
  • in suites: lenny
  • size: 167,260 kB
  • ctags: 111
  • sloc: sh: 649,491; makefile: 802
file content (111 lines) | stat: -rw-r--r-- 3,213 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh

set -e

priority=@priority@
basedir=/@basedir@
basediralias=/@basediralias@
jdiralias=@jdiralias@
mandir=/@basediralias@/jre/man
srcext=1.gz
dstext=1.gz
jre_tools='@jre_tools@'
jar_packs='@jre_packs@'

case "$1" in
configure)
    [ -d /etc/.java ] || mkdir -m 755 /etc/.java
    [ -d /etc/.java/.systemPrefs ] || mkdir -m 755 /etc/.java/.systemPrefs
    if [ ! -f /etc/.java/.systemPrefs/.system.lock ]; then
	touch /etc/.java/.systemPrefs/.system.lock
	chmod 644 /etc/.java/.systemPrefs/.system.lock
    fi
    if [ ! -f /etc/.java/.systemPrefs/.systemRootModFile ]; then
	touch /etc/.java/.systemPrefs/.systemRootModFile
	chmod 644 /etc/.java/.systemPrefs/.systemRootModFile
    fi

    for i in $jar_packs; do
	jar=$(echo $i | sed 's/\.pack$/.jar/')
	$basedir/bin/unpack200 $basedir/$i $basedir/$jar
	chmod 644 $basedir/$jar
    done
    
    for i in $jre_tools; do
	unset slave1 slave2 || true
        if [ -e $mandir/man1/$i.$srcext ]; then
	    slave1="--slave \
		/usr/share/man/man1/$i.$dstext \
                $i.$dstext \
                $mandir/man1/$i.$srcext"
	fi
	# disabled
        if false && [ -e $mandir/ja/man1/$i.$srcext ]; then
	    slave2="--slave \
		/usr/share/man/ja/man1/$i.$dstext \
                ${i}_ja.$dstext \
                $mandir/ja/man1/$i.$srcext"
	fi
        update-alternatives \
            --install \
            /usr/bin/$i \
            $i \
            $basediralias/jre/bin/$i \
            $priority \
	    $slave1 $slave2
    done

    update-alternatives \
	--install /usr/bin/jexec jexec $basediralias/jre/lib/jexec $priority \
	--slave \
	    /usr/share/binfmts/jar \
	    jexec-binfmt \
	    $basediralias/jre/lib/jar.binfmt

    # register binfmt; ignore errors, the alternative may already be
    # registered by another JRE.
    if which update-binfmts >/dev/null && [ -r /usr/share/binfmts/jar ]; then
        update-binfmts --package @basename@ --import jar || true
    fi

    # fix slave links for man page alternatives
    if [ -n "$2" ] && dpkg --compare-versions "$2" lt 6-00-2ubuntu2; then
	for i in $jre_tools; do
	    current=$(LANG=C update-alternatives --display $i 2>&1 \
		| awk '/link currently points to/ { print $NF}')
	    case "$current" in /@basediralias@*)
	        update-alternatives --quiet --set $i $basediralias/jre/bin/$i
	    esac
	done
    fi

    mount | grep -qs 'on /proc type proc' || echo >&2 "/proc is not mounted; some java apps may fail"

    # activate class data sharing
    case @archdir@ in i386|sparc)
	rm -f $basedir/jre/lib/@archdir@/client/classes.jsa
	log=$(tempfile)
	if ! $basedir/bin/java -client -Xshare:dump -Xmx256m -XX:PermSize=128m > $log; then
	    rm -f $basedir/jre/lib/@archdir@/client/classes.jsa
	    cat >&2 $log
	    echo "Ignoring error generating classes.jsa"
	fi
	rm -f $log
    esac

    # respect the debconf choice not to grant the stopThread permission
    #db_get @basename@-jre/stopthread
    #if [ "$RET" = "false" ]; then
    #    POL=/etc/$jdiralias/security/java.policy
    #    mv $POL $POL.orig
    #    sed "s:\(\\tpermission java.lang.RuntimePermission \"stopThread\";\)://\\1:" < $POL.orig > $POL
    #    rm $POL.orig
    #fi

    ;;

esac

#DEBHELPER#

exit 0