-
-
Save marked/c683f07048174bed2812a6cc6eac029e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This script downloads and compiles wget-lua. | |
# | |
# first, try to detect gnutls or openssl | |
CONFIGURE_SSL_OPT="" | |
if builtin type -p pkg-config &>/dev/null | |
then | |
if pkg-config gnutls | |
then | |
echo "Compiling wget with GnuTLS." | |
CONFIGURE_SSL_OPT="--with-ssl=gnutls" | |
elif pkg-config openssl | |
then | |
echo "Compiling wget with OpenSSL." | |
CONFIGURE_SSL_OPT="--with-ssl=openssl" | |
fi | |
fi | |
WGET_DOWNLOAD_URL="http://warriorhq.archiveteam.org/downloads/wget-lua/wget-1.14.lua.LATEST.tar.bz2" | |
rm -rf get-wget-lua.tmp/ | |
mkdir -p get-wget-lua.tmp | |
cd get-wget-lua.tmp | |
if builtin type -p curl &>/dev/null | |
then | |
curl -L $WGET_DOWNLOAD_URL | tar -xj --strip-components=1 | |
elif builtin type -p wget &>/dev/null | |
then | |
wget --output-document=- $WGET_DOWNLOAD_URL | tar -xj --strip-components=1 | |
else | |
echo "You need Curl or Wget to download the source files." | |
exit 1 | |
fi | |
if [[ ! -d "/usr/include/lua5.1" && -d "/usr/include/lua-5.1" ]] | |
then | |
echo | |
echo "###################################################################" | |
echo | |
echo "lua libs found in alternate location" | |
echo "Applying Patch" | |
echo | |
sed -i 's%lua5.1%lua-5.1%g' configure.ac | |
fi | |
if ./bootstrap && ./configure $CONFIGURE_SSL_OPT --disable-nls && make && src/wget -V | grep -q lua | |
then | |
cd tests | |
sed -i -e 's%/{{port}}%/\\{\\{port\\}\\}%g' FTPServer.pm FTPTest.pm HTTPServer.pm HTTPTest.pm Test-proxied-https-auth.px | |
make check | |
cd .. | |
cp src/wget ../wget-lua | |
cd ../ | |
echo | |
echo | |
echo "###################################################################" | |
echo | |
echo "wget-lua successfully built." | |
echo | |
./wget-lua --help | grep -iE "gnu|warc|lua" | |
rm -rf get-wget-lua.tmp | |
exit 0 | |
else | |
echo | |
echo | |
echo "###################################################################" | |
echo | |
echo "wget-lua not successfully built." | |
echo | |
exit 1 | |
fi | |
exit 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment