This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathprep-gsissh
executable file
·107 lines (95 loc) · 3.32 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#! /bin/sh
openssh_version=7.5p1
gsissh_version=${openssh_version}b
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_5_P1-hpn-14.13.diff"
# Patch1 is the iSSHD patch to HPN-SSH
Patch1="https://github.com/globus/gsi-openssh/releases/download/${gsissh_version}/hpn-14.13-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.7.5p1b.patch"
##Patch3 is the OpenSSL 1.1 patch to be applied on top of the GSI patch and is constructed as follows:
Patch3="https://github.com/globus/gsi-openssh/releases/download/${gsissh_version}/hpn_isshd-gsi_ossl.${gsissh_version}.patch"
Patches="${Patch0} ${Patch1} ${Patch2} ${Patch3}"
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}")"
printf "$(basename "${source_path}")..."
if [ ! -f "${source_path}" ]; then
download "${f}" "${source_path}"
printf "download result $?\n"
else
printf "already downloaded\n"
fi
done
printf "Unpacking and patching...\n"
if [ ! -f "${unpacked_file}" ] || \
[ x$(cat "${unpacked_file}") != x"${openssh_tarball}" ]; then
rm -rf "${gsissh_sourcedir}"
mkdir -p "${gsissh_sourcedir}"
printf "openssh tarball...\n"
gzip -dc "${package_output}/${openssh_tarball}" | \
tar --strip 1 -C "${gsissh_sourcedir}" -xf -
if [ $? = 0 ]; then
printf "ok\n"
else
printf "not ok\n"
fi
for p in ${Patches}; do
printf "Applying patch $(basename "$p")..."
patchfile="${package_output}/$(basename "${p}")"
patch -s -d "${gsissh_sourcedir}" -p1 < "${patchfile}"
if [ $? = 0 ]; then
printf "ok\n"
else
printf "not ok\n"
fi
done
printf "Creating configure.gnu..."
cat <<-"EOF" >"${gsissh_sourcedir}/configure.gnu"
#! /bin/sh
"${0%.gnu}" "$@" --with-gsi --sysconfdir="\${prefix}/etc/gsissh"
EOF
if [ $? = 0 ]; then
printf "ok\n"
else
printf "not ok\n"
fi
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
cp build-aux/ltmain.sh m4/l*.m4 gsi_openssh/source
(cd gsi_openssh/source; aclocal; autoconf)