forked from globus/globus-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prep-gsissh
executable file
·78 lines (68 loc) · 2.44 KB
/
prep-gsissh
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
#! /bin/sh
openssh_version=7.3p1
gsissh_version=${openssh_version}c
openssh_tarball=openssh-${openssh_version}.tar.gz
Source0=http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${openssh_tarball}
# Patch0 is the HPN-SSH patch to Portable OpenSSH
Patch0=https://github.com/globus/gsi-openssh/releases/download/${gsissh_version}/openssh-7_3_P1-hpn-14.12.patch
# Patch1 is the iSSHD patch to HPN-SSH
Patch1=https://github.com/globus/gsi-openssh/releases/download/${gsissh_version}/hpn-14.12-isshd.v3.19.1.patch
# Patch2 is the GSI patch to be applied on top of the iSSHD patch
Patch2=https://github.com/globus/gsi-openssh/releases/download/${gsissh_version}/hpn_isshd-gsi.${gsissh_version}.patch
Patches="${Patch0} ${Patch1} ${Patch2}"
Sources="${Patches} ${Source0}"
package_output="$(dirname "$0")/packaging/package-output"
gsissh_sourcedir="$(dirname $0)/gsi_openssh/source"
unpacked_file="${gsissh_sourcedir}/gsissh.unpacked"
if command -v curl > /dev/null 2>&1; then
download()
{
curl -Ls "$1" > "${2}.tmp"
mv "${2}.tmp" "${2}"
}
elif command -v wget > /dev/null 2>&1; then
download()
{
wget -q -O "${2}.tmp" "$1"
mv "${2}.tmp" "${2}"
}
else
download()
{
echo "Can't download ${1}" 1>&2
exit 1
}
fi
(
mkdir -p "${package_output}" "${gsissh_sourcedir}"
for f in ${Sources}; do
source_path="${package_output}/$(basename "${f}")"
if [ ! -f "${source_path}" ]; then
download "${f}" "${source_path}"
fi
done
if [ ! -f "${unpacked_file}" ] || \
[ x$(cat "${unpacked_file}") != x"${openssh_tarball}" ]; then
rm -rf "${gsissh_sourcedir}"
mkdir -p "${gsissh_sourcedir}"
gzip -dc "${package_output}/${openssh_tarball}" | \
tar --strip 1 -C "${gsissh_sourcedir}" -xf -
for p in ${Patches}; do
patchfile="${package_output}/$(basename "${p}")"
patch -d "${gsissh_sourcedir}" -p1 < "${patchfile}"
done
cat <<-"EOF" >"${gsissh_sourcedir}/configure.gnu"
#! /bin/sh
"${0%.gnu}" "$@" --with-gsi --sysconfdir="\${prefix}/etc/gsissh"
EOF
chmod a+x "${gsissh_sourcedir}/configure.gnu"
echo "${openssh_tarball}" > "${unpacked_file}"
fi
) 1>&2
echo "m4_define([gsissh_version], [${gsissh_version}])" > gsi_openssh/version.m4.new
if [ ! -f gsi_openssh/version.m4 ] || \
! cmp -s gsi_openssh/version.m4 gsi_openssh/version.m4.new; then
mv gsi_openssh/version.m4.new gsi_openssh/version.m4
else
rm -f gsi_openssh/version.m4.new
fi