forked from iay/shibboleth-idp-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch-shib-snapshot
executable file
·64 lines (50 loc) · 1.32 KB
/
fetch-shib-snapshot
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
#!/bin/bash
#
# Fetch the Shibboleth release to use.
#
. VERSIONS
#
# Exit when any command fails
#
set -e
#
# Destination directory
#
DEST=fetched-${SHIB_RELEASE}-$(date +%F)
DEST2=fetched
# Maven coordinates
MVN_G=net.shibboleth.idp
MVN_A=idp-distribution
MVN_R=snapshots
MVN_V=$SHIB_RELEASE-SNAPSHOT
# Where to get things from
MVN_RED=https://build.shibboleth.net/nexus/service/local/artifact/maven/redirect
SHIB_BASE=$MVN_RED\?r=$MVN_R\&g=$MVN_G\&a=$MVN_A\&v=$MVN_V
#echo "Base: $SHIB_BASE"
SHIB_PREFIX=shibboleth-identity-provider-$MVN_V
#echo "Prefix: $SHIB_PREFIX"
# Import Shibboleth project keys
gpg --import SHIB_KEYS
# Fetch everything into a clean download directory
rm -rf $DEST
mkdir $DEST
cd $DEST
# Fetch the IdP release
SHIB_ARCHIVE=$SHIB_PREFIX.tar.gz
wget -O $SHIB_ARCHIVE $SHIB_BASE\&p=tar.gz
wget -O $SHIB_ARCHIVE.sha1 $SHIB_BASE\&p=tar.gz.sha1
# Rewrite the SHA-1 checksum with a file name
checksum=$(cat $SHIB_ARCHIVE.sha1)
echo $checksum $SHIB_ARCHIVE>$SHIB_ARCHIVE.sha1
# Verify SHA-1 checksum on IdP release
echo SHA-1 check for $SHIB_ARCHIVE
sha1sum --check $SHIB_ARCHIVE.sha1
# Unpack IdP and rename to standard directories
tar xf $SHIB_ARCHIVE
mv $SHIB_PREFIX shibboleth-dist
cd ..
# Copy to normal "fetched" directory
echo "Downloaded to $DEST, copying to $DEST2."
rm -rf $DEST2
cp -r $DEST $DEST2
# End.