| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
set -u |
| 5 |
|
| 6 |
myself=`echo "$0" | sed 's,.*/,,'` |
| 7 |
|
| 8 |
say() |
| 9 |
{ |
| 10 |
echo "$myself: $@." |
| 11 |
} |
| 12 |
|
| 13 |
die() |
| 14 |
{ |
| 15 |
echo >&2 "$myself: $@." |
| 16 |
exit 1 |
| 17 |
} |
| 18 |
|
| 19 |
found_browser=no |
| 20 |
|
| 21 |
if [ ! -f lib/system.h ] |
| 22 |
then |
| 23 |
if [ -f ../lib/system.h ] |
| 24 |
then |
| 25 |
cd .. |
| 26 |
else |
| 27 |
die 'Please call me from the NSCA-ng source directory' |
| 28 |
fi |
| 29 |
fi |
| 30 |
|
| 31 |
for browser in 'lynx' 'elinks' 'links' |
| 32 |
do |
| 33 |
if type `expr "$browser" : '\([^ ]*\)'` >/dev/null 2>&1 && |
| 34 |
$browser -dump 'https://www.openssl.org/' >/dev/null 2>&1 |
| 35 |
then |
| 36 |
found_browser=yes |
| 37 |
break |
| 38 |
fi |
| 39 |
done |
| 40 |
|
| 41 |
test "$found_browser" = yes || |
| 42 |
die 'Cannot find a usable text web browser, please install lynx(1)' |
| 43 |
|
| 44 |
install_dir=`pwd`/lib/ssl |
| 45 |
tarball=`$browser -dump 'https://www.openssl.org/source/' | |
| 46 |
sed -n 's/.*\(openssl-[1-9].*\.tar\.gz\).*/\1/p' | head -1` |
| 47 |
|
| 48 |
if [ ! -f "$tarball" ] |
| 49 |
then |
| 50 |
if type curl >/dev/null 2>&1 |
| 51 |
then |
| 52 |
get="curl -L -o $tarball" |
| 53 |
elif type wget >/dev/null 2>&1 |
| 54 |
then |
| 55 |
get=wget |
| 56 |
else |
| 57 |
say 'Cannot find an HTTP client' |
| 58 |
die "Please download '$tarball' into `pwd`" |
| 59 |
fi |
| 60 |
|
| 61 |
$get "https://www.openssl.org/source/$tarball" |
| 62 |
test -f "$tarball" || die "Downloading '$tarball' failed" |
| 63 |
fi |
| 64 |
|
| 65 |
gzip -c -d "$tarball" | tar xf - |
| 66 |
cd `expr "$tarball" : '\(.*\)\.tar\.gz$'` |
| 67 |
|
| 68 |
./config --prefix="$install_dir" no-shared no-threads |
| 69 |
make |
| 70 |
make install |
| 71 |
|
| 72 |
say 'Success' |
| 73 |
|
| 74 |
# vim:set joinspaces noexpandtab textwidth=80: |