Alex Kashchenko 8795728
#!/bin/bash
Alex Kashchenko 8795728
Alex Kashchenko 8795728
# Copyright (C) 2019 Red Hat, Inc.
Alex Kashchenko 8795728
# Written by Andrew John Hughes <gnu.andrew@redhat.com>.
Alex Kashchenko 8795728
#
Alex Kashchenko 8795728
# This program is free software: you can redistribute it and/or modify
Alex Kashchenko 8795728
# it under the terms of the GNU Affero General Public License as
Alex Kashchenko 8795728
# published by the Free Software Foundation, either version 3 of the
Alex Kashchenko 8795728
# License, or (at your option) any later version.
Alex Kashchenko 8795728
#
Alex Kashchenko 8795728
# This program is distributed in the hope that it will be useful,
Alex Kashchenko 8795728
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Alex Kashchenko 8795728
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Alex Kashchenko 8795728
# GNU Affero General Public License for more details.
Alex Kashchenko 8795728
#
Alex Kashchenko 8795728
# You should have received a copy of the GNU Affero General Public License
Alex Kashchenko 8795728
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Alex Kashchenko 8795728
Alex Kashchenko 8795728
ICEDTEA_VERSION=3.11.0
Alex Kashchenko 8795728
ICEDTEA_URL=https://icedtea.classpath.org/download/source
Alex Kashchenko 8795728
ICEDTEA_SIGNING_KEY=CFDA0F9B35964222
Alex Kashchenko 8795728
Alex Kashchenko 8795728
set -e
Alex Kashchenko 8795728
Alex Kashchenko 8795728
if test "x${WGET}" = "x"; then
Alex Kashchenko 8795728
    WGET=$(which wget);
Alex Kashchenko 8795728
    if test "x${WGET}" = "x"; then
Alex Kashchenko 8795728
	echo "wget not found";
Alex Kashchenko 8795728
	exit 1;
Alex Kashchenko 8795728
    fi
Alex Kashchenko 8795728
fi
Alex Kashchenko 8795728
Alex Kashchenko 8795728
if test "x${CHECKSUM}" = "x"; then
Alex Kashchenko 8795728
    CHECKSUM=$(which sha256sum)
Alex Kashchenko 8795728
    if test "x${CHECKSUM}" = "x"; then
Alex Kashchenko 8795728
	echo "sha256sum not found";
Alex Kashchenko 8795728
	exit 2;
Alex Kashchenko 8795728
    fi
Alex Kashchenko 8795728
fi
Alex Kashchenko 8795728
Alex Kashchenko 8795728
if test "x${PGP}" = "x"; then
Alex Kashchenko 8795728
    PGP=$(which gpg)
Alex Kashchenko 8795728
    if test "x${PGP}" = "x"; then
Alex Kashchenko 8795728
	echo "gpg not found";
Alex Kashchenko 8795728
	exit 3;
Alex Kashchenko 8795728
    fi
Alex Kashchenko 8795728
fi
Alex Kashchenko 8795728
Alex Kashchenko 8795728
if test "x${TAR}" = "x"; then
Alex Kashchenko 8795728
    TAR=$(which tar)
Alex Kashchenko 8795728
    if test "x${TAR}" = "x"; then
Alex Kashchenko 8795728
	echo "tar not found";
Alex Kashchenko 8795728
	exit 4;
Alex Kashchenko 8795728
    fi
Alex Kashchenko 8795728
fi
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Dependencies:";
Alex Kashchenko 8795728
echo -e "\tWGET: ${WGET}";
Alex Kashchenko 8795728
echo -e "\tCHECKSUM: ${CHECKSUM}";
Alex Kashchenko 8795728
echo -e "\tPGP: ${PGP}\n";
Alex Kashchenko 8795728
echo -e "\tTAR: ${TAR}\n";
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Checking for IcedTea signing key ${ICEDTEA_SIGNING_KEY}...";
Alex Kashchenko 8795728
if ! gpg --list-keys ${ICEDTEA_SIGNING_KEY}; then
Alex Kashchenko 8795728
    echo "IcedTea signing key ${ICEDTEA_SIGNING_KEY} not installed.";
Alex Kashchenko 8795728
    exit 5;
Alex Kashchenko 8795728
fi
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Downloading IcedTea release tarball...";
Alex Kashchenko 8795728
${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz
Alex Kashchenko 8795728
echo "Downloading IcedTea tarball signature...";
Alex Kashchenko 8795728
${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.tar.xz.sig
Alex Kashchenko 8795728
echo "Downloading IcedTea tarball checksums...";
Alex Kashchenko 8795728
${WGET} -v ${ICEDTEA_URL}/icedtea-${ICEDTEA_VERSION}.sha256
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Verifying checksums...";
Alex Kashchenko 8795728
${CHECKSUM} --check --ignore-missing icedtea-${ICEDTEA_VERSION}.sha256
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Checking signature...";
Alex Kashchenko 8795728
${PGP} --verify icedtea-${ICEDTEA_VERSION}.tar.xz.sig
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Extracting files...";
Alex Kashchenko 8795728
${TAR} xJf icedtea-${ICEDTEA_VERSION}.tar.xz \
Alex Kashchenko 8795728
       icedtea-${ICEDTEA_VERSION}/tapset \
Alex Kashchenko 8795728
       icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in \
Alex Kashchenko 8795728
       icedtea-${ICEDTEA_VERSION}/policytool.desktop.in
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Replacing desktop files...";
Alex Kashchenko 8795728
mv -v icedtea-${ICEDTEA_VERSION}/jconsole.desktop.in .
Alex Kashchenko 8795728
mv -v icedtea-${ICEDTEA_VERSION}/policytool.desktop.in .
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Adding temporary fix to policytool.desktop (PR3718)";
Alex Kashchenko 8795728
sed -i 's#Development#Settings#' policytool.desktop.in
Alex Kashchenko 8795728
echo "Adding temporary fix to policytool.desktop (PR3719)";
Alex Kashchenko 8795728
sed -i 's#_BINDIR_#_JREBINDIR_#' policytool.desktop.in
Alex Kashchenko 8795728
Alex Kashchenko 8795728
echo "Creating new tapset tarball...";
Alex Kashchenko 8795728
mv -v icedtea-${ICEDTEA_VERSION} openjdk
Alex Kashchenko 8795728
${TAR} cJf tapsets-icedtea-${ICEDTEA_VERSION}.tar.xz openjdk
Alex Kashchenko 8795728
Alex Kashchenko 8795728
rm -rvf openjdk
Alex Kashchenko 8795728
rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz
Alex Kashchenko 8795728
rm -vf icedtea-${ICEDTEA_VERSION}.tar.xz.sig
Alex Kashchenko 8795728
rm -vf icedtea-${ICEDTEA_VERSION}.sha256