%PDF- %PDF-
| Direktori : /var/lib/dpkg/info/ |
| Current File : //var/lib/dpkg/info/openjdk-11-jre-headless:amd64.postinst |
#!/bin/sh
set -e
multiarch=x86_64-linux-gnu
priority=1111
basedir=/usr/lib/jvm/java-11-openjdk-amd64
mandir=$basedir/man
srcext=1.gz
dstext=1.gz
jre_tools='java jjs keytool rmid rmiregistry pack200 unpack200'
case "$1" in
configure)
# fail early. java currently uses tricks to find its own shared
# libraries depending on the path of the binary. Will be changed
# in OpenJDK7
if ! mountpoint -q /proc; then
echo >&2 "the java command requires a mounted proc fs (/proc)."
exit 1
fi
[ -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
if [ -z "$2" ]; then
update_alternatives=y
fi
if [ -n "$multiarch" ] && [ -n "$2" ]; then
for i in $jre_tools; do
if [ -z "$(update-alternatives --list $i 2>/dev/null | grep ^$basedir/)" ]; then
update_alternatives=y
break
fi
done
fi
if [ "$update_alternatives" != y ] && [ $priority -gt 1060 ]; then
for i in $jre_tools; do
oldp=$(update-alternatives --query java | awk -v b=$basedir '/^Alternative:/ && $2~b {p=1} /^Priority:/ && p {print $2; exit}')
if [ -n "$oldp" ] && [ "$oldp" -le 1060 ]; then
update_alternatives=y
break
fi
done
fi
if dpkg --compare-versions "$2" lt-nl "11.0.11+7-2~" ; then
# jfr moved from jre to jdk, remove dangling alternative on upgrades
test -x $basedir/bin/jfr || update-alternatives --remove jfr $basedir/bin/jfr
fi
if [ "$update_alternatives" = y ]; then
if [ -n "$multiarch" ] && [ "$DPKG_MAINTSCRIPT_ARCH" != $(dpkg --print-architecture) ]; then
priority=$(expr $priority - 1)
fi
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 \
$basedir/bin/$i \
$priority \
$slave1 $slave2
done
update-alternatives \
--install /usr/bin/jexec jexec $basedir/lib/jexec $priority \
--slave \
/usr/share/binfmts/jar \
jexec-binfmt \
$basedir/lib/jar.binfmt
fi # update alternatives
# 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 openjdk-11 --import jar || true
fi
# activate class data sharing
case amd64 in i386|i586|sparc)
rm -f $basedir/lib/client/classes.jsa
log=$(mktemp)
if ! $basedir/bin/java -client -Xshare:dump -XX:PermSize=128m > $log; then
cat >&2 $log
rm -f $log
# this may fail on some machines/configurations, just ignore it.
echo >&2 "ignoring dump failure"
#exit 1
fi
rm -f $log
esac
case amd64 in amd64|i386|i586|sparc)
rm -f $basedir/lib/server/classes.jsa
log=$(mktemp)
if ! $basedir/bin/java -server -Xshare:dump > $log; then
cat >&2 $log
rm -f $log
# this may fail on some machines/configurations, just ignore it.
echo >&2 "ignoring dump failure"
#exit 1
fi
rm -f $log
esac
# Now that java is fully registered and configured,
# call update-ca-certificates-java
dpkg-trigger update-ca-certificates-java
;;
esac
exit 0