226 lines
8.9 KiB
Bash
226 lines
8.9 KiB
Bash
|
#!/bin/bash
|
||
|
FIJI_ROOT_PATH='/Applications/Fiji.app'
|
||
|
|
||
|
|
||
|
|
||
|
function ensure_maven_in_installed()
|
||
|
{
|
||
|
sudo port install maven32
|
||
|
sudo port select --set maven maven32
|
||
|
}
|
||
|
|
||
|
function accept_maven_scijava_org_certificate()
|
||
|
{
|
||
|
# fixes (using the nice description in https://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art032) the following error when executing "mvn -Dimagej.app.directory=/Applications/Fiji.app"
|
||
|
# [INFO] ------------------------------------------------------------------------
|
||
|
# [ERROR] Failed to execute goal on project example-script-collection: Could not resolve dependencies for project org.scijava:example-script-collection:jar:0.1.0-SNAPSHOT: Failed to collect dependencies at net.imagej:imagej:jar:2.0.0-rc-71: Failed to read artifact descriptor for net.imagej:imagej:jar:2.0.0-rc-71: Could not transfer artifact net.imagej:imagej:pom:2.0.0-rc-71 from/to scijava.public (https://maven.scijava.org/content/groups/public): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
|
||
|
# [ERROR]
|
||
|
# [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
|
||
|
|
||
|
|
||
|
local java_home=$(/usr/libexec/java_home)
|
||
|
#[1]graffy@pr079234:~/toto/example-script-collection[15:43:02]>/usr/libexec/java_home
|
||
|
#/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
|
||
|
local jre_home="$java_home/jre"
|
||
|
keytool -list -keystore $jre_home/lib/security/cacerts
|
||
|
# just press enter on the password prompt
|
||
|
|
||
|
# [1]graffy@pr079234:~/toto/example-script-collection[15:44:43]>keytool -list -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/security/cacerts
|
||
|
# Enter keystore password:
|
||
|
|
||
|
# ***************** WARNING WARNING WARNING *****************
|
||
|
# * The integrity of the information stored in your keystore *
|
||
|
# * has NOT been verified! In order to verify its integrity, *
|
||
|
# * you must provide your keystore password. *
|
||
|
# ***************** WARNING WARNING WARNING *****************
|
||
|
|
||
|
# Keystore type: JKS
|
||
|
# Keystore provider: SUN
|
||
|
|
||
|
# Your keystore contains 93 entries
|
||
|
|
||
|
# digicertassuredidrootca, Apr 16, 2008, trustedCertEntry,
|
||
|
# Certificate fingerprint (SHA1): 05:63:B8:63:0D:62:D7:5A:BB:C8:AB:1E:4B:DF:B5:A8:99:B2:4D:43
|
||
|
# ...
|
||
|
# godaddyrootg2ca, Jul 19, 2014, trustedCertEntry,
|
||
|
# Certificate fingerprint (SHA1): 47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B
|
||
|
|
||
|
keytool -printcert -rfc -sslserver maven.scijava.org
|
||
|
# [1]graffy@pr079234:~/toto/example-script-collection[16:06:05]>keytool -printcert -rfc -sslserver maven.scijava.org
|
||
|
# -----BEGIN CERTIFICATE-----
|
||
|
# MIIFWDCCBECgAwIBAgISA7zwf4Rs4UhVp5fLyHh58bjtMA0GCSqGSIb3DQEBCwUAMEoxCzAJBgNV
|
||
|
# ...
|
||
|
# Ob5k02cDAcqlcJqIzqhxANh7UDoLw7h36hBnyIHDMbMMkfrtgMv5WSa0DZ2mZf63P6iYGUmr5dtz
|
||
|
# ciAu0w==
|
||
|
# -----END CERTIFICATE-----
|
||
|
# -----BEGIN CERTIFICATE-----
|
||
|
# MIIFWDCCBECgAwIBAgISA7zwf4Rs4UhVp5fLyHh58bjtMA0GCSqGSIb3DQEBCwUAMEoxCzAJBgNV
|
||
|
# ...
|
||
|
# Ob5k02cDAcqlcJqIzqhxANh7UDoLw7h36hBnyIHDMbMMkfrtgMv5WSa0DZ2mZf63P6iYGUmr5dtz
|
||
|
# ciAu0w==
|
||
|
# -----END CERTIFICATE-----
|
||
|
# -----BEGIN CERTIFICATE-----
|
||
|
# MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/MSQwIgYDVQQK
|
||
|
# ...
|
||
|
# TZ+sOPAveyxindmjkW8lGy+QsRlGPfZ+G6Z6h7mjem0Y+iWlkYcV4PIWL1iwBi8saCbGS5jN2p8M
|
||
|
# +X+Q7UNKEkROb3N6KOqkqm57TH2H3eDJAkSnh6/DNFu0Qg==
|
||
|
# -----END CERTIFICATE-----
|
||
|
|
||
|
# split output into:
|
||
|
# - /tmp/cert1.pem
|
||
|
# - /tmp/cert2.pem
|
||
|
# - /tmp/cert3.pem
|
||
|
keytool -importcert -file /tmp/cert1.pem -keystore $jre_home/lib/security/cacerts
|
||
|
# password : changeit
|
||
|
|
||
|
# [1]graffy@pr079234:~/toto/example-script-collection[17:12:30]>sudo keytool -importcert -file /tmp/cert1.pem -keystore $jre_home/lib/security/cacerts
|
||
|
# Password:
|
||
|
# Sorry, try again.
|
||
|
# Password:
|
||
|
# Enter keystore password:
|
||
|
# Owner: CN=maven.imagej.net
|
||
|
# Issuer: CN=Let's Encrypt Authority X3, O=Let's Encrypt, C=US
|
||
|
# Serial number: 3bcf07f846ce14855a797cbc87879f1b8ed
|
||
|
# Valid from: Sat Aug 17 07:39:53 CEST 2019 until: Fri Nov 15 06:39:53 CET 2019
|
||
|
# Certificate fingerprints:
|
||
|
# MD5: 05:B4:5A:31:AE:1F:36:71:0E:24:FB:0F:72:AE:BD:BD
|
||
|
# SHA1: E5:3E:B0:CC:8E:D0:C6:A3:EF:2F:42:93:45:60:82:C2:1B:A3:BD:F3
|
||
|
# SHA256: 74:3C:C7:2C:E6:C5:FE:9F:79:F5:F7:9D:7E:2A:4F:C9:BA:51:A0:88:95:1C:FC:15:8D:DC:EC:B0:99:BD:0E:61
|
||
|
# Signature algorithm name: SHA256withRSA
|
||
|
# Version: 3
|
||
|
|
||
|
# Extensions:
|
||
|
|
||
|
# #1: ObjectId: 1.3.6.1.4.1.11129.2.4.2 Criticality=false
|
||
|
# 0000: 04 81 F2 00 F0 00 76 00 74 7E DA 83 31 AD 33 10 ......v.t...1.3.
|
||
|
# 0010: 91 21 9C CE 25 4F 42 70 C2 BF FD 5E 42 20 08 C6 .!..%OBp...^B ..
|
||
|
# 0020: 37 35 79 E6 10 7B CC 56 00 00 01 6C 9E 4D C8 C6 75y....V...l.M..
|
||
|
# 0030: 00 00 04 03 00 47 30 45 02 20 1C DB D8 F3 9D 77 .....G0E. .....w
|
||
|
# 0040: 48 BB B3 D7 0E 50 C4 0F C0 DF 65 94 A7 C4 23 E2 H....P....e...#.
|
||
|
# 0050: 19 C3 88 4D 8D 6D D9 82 D3 BA 02 21 00 AC CC 93 ...M.m.....!....
|
||
|
# 0060: BE 28 59 5C 2E BC A0 8E 36 4D 23 FB 1D 4B 0F FE .(Y\....6M#..K..
|
||
|
# 0070: F4 38 9F C6 D1 13 53 91 62 25 0F C9 71 00 76 00 .8....S.b%..q.v.
|
||
|
# 0080: 29 3C 51 96 54 C8 39 65 BA AA 50 FC 58 07 D4 B7 )<Q.T.9e..P.X...
|
||
|
# 0090: 6F BF 58 7A 29 72 DC A4 C3 0C F4 E5 45 47 F4 78 o.Xz)r......EG.x
|
||
|
# 00A0: 00 00 01 6C 9E 4D CA AD 00 00 04 03 00 47 30 45 ...l.M.......G0E
|
||
|
# 00B0: 02 20 5B D4 50 BC 32 89 32 C4 33 EB 5B 30 3F 25 . [.P.2.2.3.[0?%
|
||
|
# 00C0: F0 7C A6 D4 8A F7 8B AB 55 3A 54 6D F9 2E C9 DE ........U:Tm....
|
||
|
# 00D0: D3 4B 02 21 00 8C A8 8B D3 38 20 38 A1 BB 37 B3 .K.!.....8 8..7.
|
||
|
# 00E0: EE 3A 38 17 82 16 D3 1C E0 30 95 C4 E7 F7 8A 26 .:8......0.....&
|
||
|
# 00F0: 62 B7 BC AF DF b....
|
||
|
|
||
|
|
||
|
# #2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
|
||
|
# AuthorityInfoAccess [
|
||
|
# [
|
||
|
# accessMethod: ocsp
|
||
|
# accessLocation: URIName: http://ocsp.int-x3.letsencrypt.org
|
||
|
# ,
|
||
|
# accessMethod: caIssuers
|
||
|
# accessLocation: URIName: http://cert.int-x3.letsencrypt.org/
|
||
|
# ]
|
||
|
# ]
|
||
|
|
||
|
# #3: ObjectId: 2.5.29.35 Criticality=false
|
||
|
# AuthorityKeyIdentifier [
|
||
|
# KeyIdentifier [
|
||
|
# 0000: A8 4A 6A 63 04 7D DD BA E6 D1 39 B7 A6 45 65 EF .Jjc......9..Ee.
|
||
|
# 0010: F3 A8 EC A1 ....
|
||
|
# ]
|
||
|
# ]
|
||
|
|
||
|
# #4: ObjectId: 2.5.29.19 Criticality=true
|
||
|
# BasicConstraints:[
|
||
|
# CA:false
|
||
|
# PathLen: undefined
|
||
|
# ]
|
||
|
|
||
|
# #5: ObjectId: 2.5.29.32 Criticality=false
|
||
|
# CertificatePolicies [
|
||
|
# [CertificatePolicyId: [2.23.140.1.2.1]
|
||
|
# [] ]
|
||
|
# [CertificatePolicyId: [1.3.6.1.4.1.44947.1.1.1]
|
||
|
# [PolicyQualifierInfo: [
|
||
|
# qualifierID: 1.3.6.1.5.5.7.2.1
|
||
|
# qualifier: 0000: 16 1A 68 74 74 70 3A 2F 2F 63 70 73 2E 6C 65 74 ..http://cps.let
|
||
|
# 0010: 73 65 6E 63 72 79 70 74 2E 6F 72 67 sencrypt.org
|
||
|
|
||
|
# ]] ]
|
||
|
# ]
|
||
|
|
||
|
# #6: ObjectId: 2.5.29.37 Criticality=false
|
||
|
# ExtendedKeyUsages [
|
||
|
# serverAuth
|
||
|
# clientAuth
|
||
|
# ]
|
||
|
|
||
|
# #7: ObjectId: 2.5.29.15 Criticality=true
|
||
|
# KeyUsage [
|
||
|
# DigitalSignature
|
||
|
# Key_Encipherment
|
||
|
# ]
|
||
|
|
||
|
# #8: ObjectId: 2.5.29.17 Criticality=false
|
||
|
# SubjectAlternativeName [
|
||
|
# DNSName: maven.imagej.net
|
||
|
# ]
|
||
|
|
||
|
# #9: ObjectId: 2.5.29.14 Criticality=false
|
||
|
# SubjectKeyIdentifier [
|
||
|
# KeyIdentifier [
|
||
|
# 0000: 63 09 5F EA C5 C8 7D 24 DD 2B 11 71 BB FB F6 F9 c._....$.+.q....
|
||
|
# 0010: 6F 7C BD 0A o...
|
||
|
# ]
|
||
|
# ]
|
||
|
|
||
|
# Trust this certificate? [no]: yes
|
||
|
# Certificate was added to keystore
|
||
|
|
||
|
|
||
|
|
||
|
#> mykey, Sep 20, 2019, trustedCertEntry,
|
||
|
#> Certificate fingerprint (SHA1): E5:3E:B0:CC:8E:D0:C6:A3:EF:2F:42:93:45:60:82:C2:1B:A3:BD:F3
|
||
|
|
||
|
#export MAVEN_OPTS="-Xmx512m -Djavax.net.ssl.trustStore=trust.jks \
|
||
|
# -Djavax.net.ssl.trustStorePassword= \
|
||
|
# -Djavax.net.ssl.keyStore=/tmp/cert1.pem \
|
||
|
# -Djavax.net.ssl.keyStoreType=pem
|
||
|
|
||
|
}
|
||
|
|
||
|
function create_test_jar()
|
||
|
{
|
||
|
git clone https://github.com/imagej/example-script-collection.git
|
||
|
|
||
|
pushd example-script-collection
|
||
|
rm -R src/test/java
|
||
|
|
||
|
ensure_maven_in_installed
|
||
|
|
||
|
accept_maven_scijava_org_certificate
|
||
|
|
||
|
mvn -Dimagej.app.directory=/Applications/Fiji.app
|
||
|
popd
|
||
|
}
|
||
|
|
||
|
function install_lipase_libs_in_fiji()
|
||
|
{
|
||
|
# https://imagej.net/Jython_Scripting
|
||
|
mkdir -p "$FIJI_ROOT_PATH/jars/Lib"
|
||
|
# cp -R ./src/* "$FIJI_ROOT_PATH/jars/Lib"
|
||
|
|
||
|
pushd src
|
||
|
find ./lipase -name "*.py" > /tmp/files.txt
|
||
|
jar cvf $FIJI_ROOT_PATH/jars/Lib/fr.univ-rennes1.ip.lipase.lib.jar @/tmp/files.txt
|
||
|
popd
|
||
|
}
|
||
|
|
||
|
function install_lipase_in_fiji()
|
||
|
{
|
||
|
install_lipase_libs_in_fiji
|
||
|
|
||
|
mkdir -p $FIJI_ROOT_PATH/plugins/Ipr
|
||
|
rsync -a ./src/ij-plugins/Ipr/ $FIJI_ROOT_PATH/plugins/Ipr/
|
||
|
}
|
||
|
|
||
|
install_lipase_in_fiji
|