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
|
#! /bin/sh -e
TMP_DIR=${TMP:=/tmp}
docdir=/usr/share/doc/@basename@-jdk
tmpdir=${docdir}/tmp
installdir=${docdir}/html
url=http://java.sun.com/j2se/1.5.0/download.html
archives='jdk-1_5_0-doc.zip jdk-1_5_0-doc-ja.zip'
priority=@priority@
find_archive()
{
archive=does/not/exist
for a in $archives; do
if [ -e ${TMP_DIR}/$a ]; then
archive=$a
return
fi
done
}
case "$1" in
configure)
if [ -e $installdir/index.html ]; then
cat <<-EOF
A current version of the J2SDK documentation is already installed.
This version will be left in place.
EOF
exit 0
fi
prob=1
while [ $prob -eq 1 ]; do
prob=0
find_archive
if [ ! -e "${TMP_DIR}/$archive" ]
then
cat <<-EOF
This package is an installer package, it does not actually contain the
J2SDK documentation. You will need to go download one of the
archives:
${archives}
(choose the non-update version if this is the first installation).
Please visit
${url}
now and download. The file should be owned by root.root and be copied
to /tmp.
EOF
prob=1
elif [ ! -r "${TMP_DIR}/$archive" ]; then
echo "Error: ${TMP_DIR}/$archive is not readable."
prob=1
fi
if [ $prob -eq 0 ]; then
rm -rf ${tmpdir}
mkdir -p ${tmpdir} ${installdir}
cd ${tmpdir}
unzip -q -a ${TMP_DIR}/$archive
dir=`ls | wc -l`
while [ $dir -eq 1 ]; do
cd *
dir=`ls | wc -l`
done
mv * ${installdir}
cd ${installdir}
rm -rf ${tmpdir}
# mv ${installdir}/relnotes/demos.html \
# ${installdir}/relnotes/demos.html.orig
# sed -e "s:\.\./\.\./demo:/usr/lib/@basename@/demo:g" \
# ${installdir}/relnotes/demos.html.orig \
# > ${installdir}/relnotes/demos.html
# rm ${installdir}/relnotes/demos.html.orig
chown -R root.root ${installdir}
chmod -R a=rX,u+w ${installdir}
fi
if [ $prob -eq 1 ]; then
echo ""
echo -n "[Press RETURN to try again, 'no' + RETURN to abort] "
read foo
case "$foo" in [nN]|[nN][oO])
echo "Abort installation of J2SDK documentation"
exit 1
;;
esac
fi
done
echo "${TMP_DIR}/$archive has been unpacked and installed."
echo "You can now delete it, if you wish."
;;
esac
#DEBHELPER#
exit 0
|