-
Notifications
You must be signed in to change notification settings - Fork 14
/
fetch-shib-snapshot
executable file
·88 lines (71 loc) · 1.7 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
#
# Fetch the Shibboleth SNAPSHOT release to use.
#
# Requires:
#
# - wget
# - xsltproc
#
. 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_DIST_DIR=https://build.shibboleth.net/maven/$MVN_R/net/shibboleth/idp/$MVN_A/$MVN_V
echo "MVN_DIST_DIR: $MVN_DIST_DIR"
SHIB_PREFIX=shibboleth-identity-provider-$MVN_V
echo "Prefix: $SHIB_PREFIX"
#
# Pull the distribution's Maven metadata file.
#
META_TMP=maven-metadata.tmp
rm -f $META_TMP
wget -q -O $META_TMP $MVN_DIST_DIR/maven-metadata.xml
#
# Figure out what the latest version is called.
#
VSN_VALUE=`xsltproc snapshot-version.xsl $META_TMP`
echo "VSN_VALUE: $VSN_VALUE"
SRC_URI=$MVN_DIST_DIR/$MVN_A-$VSN_VALUE.tar.gz
echo "SRC_URI: $SRC_URI"
#
# Clean temporary file.
#
rm -f $META_TMP
# 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 $SRC_URI
wget -O $SHIB_ARCHIVE.sha1 $SRC_URI.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.