-
-
Save bitbeans/d41306e51b138cca3d47 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
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 89F7B8300E87E03C52B05289926BC5171CDEA439 | |
if [ $? -ne 0 ]; then | |
echo -e "\033[33mDownloading PGP Public Key...\033[0m" | |
gpg --recv-keys 89F7B8300E87E03C52B05289926BC5171CDEA439 | |
# Jedi/Sector One <[email protected]> | |
gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439 | |
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