Skip to content

Commit

Permalink
Merge pull request #1642 from chirhonul/1808-fixup-script
Browse files Browse the repository at this point in the history
Verify all checksums in prepare-system.sh
  • Loading branch information
ripcurlx authored Aug 28, 2018
2 parents 66aeff3 + 84b9070 commit cd2a86d
Showing 1 changed file with 32 additions and 27 deletions.
59 changes: 32 additions & 27 deletions package/linux/prepare-system.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,49 @@
#!/usr/bin/env bash
#
# Install dependencies necessary for releasing Bisq on Debian-like systems.
#
cd $(dirname ${0})
set -eu

cd $(dirname $0)

echo Update OS

echo "Updating OS.."
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

if [ ! -f "$JAVA_HOME/jre/lib/security/local_policy.jar" ]
then
echo "Enable strong crypto support for Java"
if [ ! -f "${JAVA_HOME}/jre/lib/security/local_policy.jar" ]; then
echo "Enabling strong crypto support for Java.."

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip

checksum=f3020a3922efd6626c2fff45695d527f34a8020e938a49292561f18ad1320b59 # see https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md
checksum=f3020a3922efd6626c2fff45695d527f34a8020e938a49292561f18ad1320b59 # see https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md

if ! echo "$checksum jce_policy-8.zip" | sha256sum -c -;
then
echo "Checksum failed" >&2
exit 1
fi
if ! echo "${checksum} jce_policy-8.zip" | sha256sum -c -; then
echo "Bad checksum for ${jce_policy-8.zip}." >&2
exit 1
fi

unzip jce_policy-8.zip
sudo cp UnlimitedJCEPolicyJDK8/{US_export_policy.jar,local_policy.jar} $JAVA_HOME/jre/lib/security/
sudo chmod 664 $JAVA_HOME/jre/lib/security/{US_export_policy.jar,local_policy.jar}
sudo rm -rf UnlimitedJCEPolicyJDK8 jce_policy-8.zip
unzip jce_policy-8.zip
sudo cp UnlimitedJCEPolicyJDK8/{US_export_policy.jar,local_policy.jar} ${JAVA_HOME}/jre/lib/security/
sudo chmod 664 ${JAVA_HOME}/jre/lib/security/{US_export_policy.jar,local_policy.jar}
sudo rm -rf UnlimitedJCEPolicyJDK8 jce_policy-8.zip
else
echo "Strong Crypto support for Java already available"
echo "Strong Crypto support for Java already available."
fi

bouncyCastleJar=bcprov-jdk15on-1.56.jar

if [ ! -f "$JAVA_HOME/jre/lib/ext/$bouncyCastleJar" ]
then
echo Configure Bouncy Castle

wget "http://central.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.56/$bouncyCastleJar"
sudo mv $bouncyCastleJar $JAVA_HOME/jre/lib/ext/
sudo chmod 777 "$JAVA_HOME/jre/lib/ext/$bouncyCastleJar"
if [ ! -f "${JAVA_HOME}/jre/lib/ext/${bouncyCastleJar}" ]; then
echo "Configuring Bouncy Castle.."
checksum="963e1ee14f808ffb99897d848ddcdb28fa91ddda867eb18d303e82728f878349"
wget "http://central.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.56/${bouncyCastleJar}"
if ! echo "${checksum} ${bouncyCastleJar}" | sha256sum -c -; then
echo "Bad checksum for ${bouncyCastleJar}." >&2
exit 1
fi
sudo mv ${bouncyCastleJar} ${JAVA_HOME}/jre/lib/ext/
sudo chmod 777 "${JAVA_HOME}/jre/lib/ext/${bouncyCastleJar}"
else
echo Bouncy Castle already configured
echo "Bouncy Castle already configured."
fi

echo "Done."

0 comments on commit cd2a86d

Please sign in to comment.