Forked from sarciszewski/install-libsodium.sh
Last active
September 14, 2017 00:29
-
-
Save jonathanpmartins/99a5cf16a3611a1cd55f to your computer and use it in GitHub Desktop.
Install libsodium-1.0.2 and PECL libsodium on Ubuntu 14.04
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 | |
PECLVER="0.1.1" | |
LIBSODIUMVER="1.0.2" | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
gpg --fingerprint 54A2B8892CC3D6A597B92B6C210627AABA709FE1 | |
if [ $? -ne 0 ]; then | |
echo -e "\033[33mDownloading PGP Public Key...\033[0m" | |
gpg --recv-keys 54A2B8892CC3D6A597B92B6C210627AABA709FE1 | |
# Jedi/Sector One <[email protected]> | |
gpg --fingerprint 54A2B8892CC3D6A597B92B6C210627AABA709FE1 | |
if [ $? -ne 0 ]; then | |
echo -e "\033[31mCould not download PGP public key for verification\033[0m" | |
exit | |
fi | |
fi | |
# Let's try to install the PECL Extension | |
pecl install channel://pecl.php.net/libsodium-$PECLVER | |
if [ $? -ne 0 ]; then | |
# We need to install libsodium | |
mkdir tmp | |
cd tmp | |
if [ ! -f libsodium-$LIBSODIUMVER.tar.gz ]; then | |
wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUMVER.tar.gz | |
fi | |
if [ ! -f libsodium-$LIBSODIUMVER.tar.gz.sig ]; then | |
wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUMVER.tar.gz.sig | |
fi | |
gpg --verify libsodium-$LIBSODIUMVER.tar.gz.sig libsodium-$LIBSODIUMVER.tar.gz | |
if [ $? -eq 0 ]; then | |
tar -xvzf libsodium-$LIBSODIUMVER.tar.gz | |
cd libsodium-$LIBSODIUMVER | |
./configure | |
make && make check | |
if [ $? -eq 0 ]; then | |
# we passed our tests? let's install libsodium | |
make install | |
if [ $? -eq 0 ]; then | |
# cleanup | |
cd .. | |
cd .. | |
rm -rf tmp | |
# now let's install the PECL extension | |
pecl install channel://pecl.php.net/libsodium-$PECLVER | |
fi | |
fi | |
else | |
echo -e "\033[31mSignature did not match! Check /tmp/libsodium-$LIBSODIUMVER.tar.gz for trojans\033[0m" | |
cd .. | |
exit | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Ran the above sh script, following errors appearing ...
pub 4096R/BA709FE1 2015-02-10
Key fingerprint = 54A2 B889 2CC3 D6A5 97B9 2B6C 2106 27AA BA70 9FE1
uid Frank Denis (Jedi/Sector One) [email protected]
uid Frank Denis [email protected]
uid Frank Denis [email protected]
uid Frank Denis (Jedi/Sector One) [email protected]
uid Frank Denis (Jedi/Sector One) [email protected]
sub 4096R/EE11A667 2015-02-10
sub 4096R/2B6F76DA 2015-02-10
downloading libsodium-0.1.1.tgz ...
Starting to download libsodium-0.1.1.tgz (162,027 bytes)
..................................done: 162,027 bytes
8 source files, building
running: phpize
Configuring for:
PHP Api Version: 20121113
Zend Module Api No: 20121212
Zend Extension Api No: 220121212
building in /tmp/pear/temp/pear-build-rootHDfigm/libsodium-0.1.1
running: /tmp/pear/temp/libsodium/configure
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib
checking for PHP extension directory... /usr/lib/php5/20121212
checking for PHP installed headers prefix... /usr/include/php5
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for libsodium support... yes, shared
checking for libsodium files in default path... not found
configure: error: Please reinstall the libsodium distribution
ERROR: `/tmp/pear/temp/libsodium/configure' failed