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