-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchange_checksum.sh
executable file
·76 lines (57 loc) · 1.64 KB
/
change_checksum.sh
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
#!/bin/sh
# Whenever Globus brings out a new release, some of the packages
# do not jump version but autogenerated files are updated.
# Because the timestamps change, so does the checksum of the
# tarball.
# This script extracts the new checksums from a given collection
# of packages and will replace the checksums in the Portfiles
# corresponding to those packages.
# Most package names and ports correspond one-to-one modulo
# replacing the '_' with '-', with the exception of gpt
# which is called grid-packaging-tools
set -e
VERBOSE=0
usage() {
echo "Usage: $0 <package-dir> [ <port-dir> ]
Collect checksums in the Globus toolkit package-dir and
update the corresponding Portfiles in the port-dir.
Use '.' if port-dir is not given.
"
}
if [ $# -lt 1 ]; then
usage
exit 2
else
PKG_DIR="$1"
PORT_DIR="$2"
fi
if [ -z "$PORT_DIR" ] ; then
PORT_DIR=.
fi
if ! cd "$PORT_DIR" ; then
echo "Can't change directory to $PORT_DIR" >&2
exit 1
fi
PKGS=`ls -d globus-* myproxy grid-packaging-tools`
cd "$OLDPWD"
for p in $PKGS ; do
case $p in
grid-packaging-tools)
name=gpt
;;
globus-clients)
# skip it because it's our metapackage
continue
;;
*)
name=`echo $p | tr '-' '_'`
esac
file_name=`ls $PKG_DIR/$name-*.tar.gz`
r160=`openssl rmd160 $file_name | cut -f 2 -d ' '`
sha=`openssl sha256 $file_name | cut -f 2 -d ' '`
if [ "$VERBOSE" -gt 0 ] ; then
echo $p $r160 $sha
fi
sed -i.bak "s/ *sha256.*/ sha256 $sha \\\\/" "$PORT_DIR/$p/Portfile"
sed -i.bak "s/ *rmd160.*/ rmd160 $r160/" "$PORT_DIR/$p/Portfile"
done