Skip to content

Instantly share code, notes, and snippets.

@sarciszewski
Last active July 15, 2016 08:52
Show Gist options
  • Select an option

  • Save sarciszewski/f03aae0b4c521c138b94 to your computer and use it in GitHub Desktop.

Select an option

Save sarciszewski/f03aae0b4c521c138b94 to your computer and use it in GitHub Desktop.

Revisions

  1. sarciszewski revised this gist Mar 29, 2015. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions install-libsodium.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    #!/bin/sh
    #!/usr/bin/env bash

    PECLVER="0.1.1"
    LIBSODIUMVER="1.0.2"

    @@ -7,12 +8,12 @@ if [[ $EUID -ne 0 ]]; then
    exit 1
    fi

    gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439
    gpg --fingerprint 54A2B8892CC3D6A597B92B6C210627AABA709FE1
    if [ $? -ne 0 ]; then
    echo -e "\033[33mDownloading PGP Public Key...\033[0m"
    gpg --recv-keys 89F7B8300E87E03C52B05289926BC5171CDEA439
    gpg --recv-keys 54A2B8892CC3D6A597B92B6C210627AABA709FE1
    # Jedi/Sector One <[email protected]>
    gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439
    gpg --fingerprint 54A2B8892CC3D6A597B92B6C210627AABA709FE1
    if [ $? -ne 0 ]; then
    echo -e "\033[31mCould not download PGP public key for verification\033[0m"
    exit
  2. sarciszewski revised this gist Jan 19, 2015. 1 changed file with 12 additions and 10 deletions.
    22 changes: 12 additions & 10 deletions install-libsodium.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #!/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
    @@ -18,21 +20,21 @@ if [ $? -ne 0 ]; then
    fi

    # Let's try to install the PECL Extension
    pecl install channel://pecl.php.net/libsodium-0.1.1
    pecl install channel://pecl.php.net/libsodium-$PECLVER
    if [ $? -ne 0 ]; then
    # We need to install libsodium
    mkdir tmp
    cd tmp
    if [ ! -f libsodium-1.0.2.tar.gz ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz
    if [ ! -f libsodium-$LIBSODIUMVER.tar.gz ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUMVER.tar.gz
    fi
    if [ ! -f libsodium-1.0.2.tar.gz.sig ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz.sig
    if [ ! -f libsodium-$LIBSODIUMVER.tar.gz.sig ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-$LIBSODIUMVER.tar.gz.sig
    fi
    gpg --verify libsodium-1.0.2.tar.gz.sig libsodium-1.0.2.tar.gz
    gpg --verify libsodium-$LIBSODIUMVER.tar.gz.sig libsodium-$LIBSODIUMVER.tar.gz
    if [ $? -eq 0 ]; then
    tar -xvzf libsodium-1.0.2.tar.gz
    cd libsodium-1.0.2
    tar -xvzf libsodium-$LIBSODIUMVER.tar.gz
    cd libsodium-$LIBSODIUMVER
    ./configure
    make && make check
    if [ $? -eq 0 ]; then
    @@ -44,11 +46,11 @@ if [ $? -ne 0 ]; then
    cd ..
    rm -rf tmp
    # now let's install the PECL extension
    pecl install channel://pecl.php.net/libsodium-0.1.1
    pecl install channel://pecl.php.net/libsodium-$PECLVER
    fi
    fi
    else
    echo -e "\033[31mSignature did not match! Check /tmp/libsodium-1.0.2.tar.gz for trojans\033[0m"
    echo -e "\033[31mSignature did not match! Check /tmp/libsodium-$LIBSODIUMVER.tar.gz for trojans\033[0m"
    cd ..
    exit
    fi
  3. sarciszewski revised this gist Jan 18, 2015. 1 changed file with 16 additions and 13 deletions.
    29 changes: 16 additions & 13 deletions install-libsodium.sh
    Original file line number Diff line number Diff line change
    @@ -5,12 +5,12 @@ if [[ $EUID -ne 0 ]]; then
    exit 1
    fi

    gpg --fingerprint 0x926BC5171CDEA439
    gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439
    if [ $? -ne 0 ]; then
    echo -e "\033[33mDownloading PGP Public Key...\033[0m"
    gpg --recv-keys 0x926BC5171CDEA439
    gpg --recv-keys 89F7B8300E87E03C52B05289926BC5171CDEA439
    # Jedi/Sector One <[email protected]>
    gpg --fingerprint 0x926BC5171CDEA439
    gpg --fingerprint 89F7B8300E87E03C52B05289926BC5171CDEA439
    if [ $? -ne 0 ]; then
    echo -e "\033[31mCould not download PGP public key for verification\033[0m"
    exit
    @@ -21,32 +21,35 @@ fi
    pecl install channel://pecl.php.net/libsodium-0.1.1
    if [ $? -ne 0 ]; then
    # We need to install libsodium
    mkdir tmp
    mkdir tmp
    cd tmp
    if [ ! -f libsodium-1.0.2.tar.gz ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz
    fi
    if [ ! -f libsodium-1.0.2.tar.gz.sig ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz.sig
    fi

    gpg --verify libsodium-1.0.2.tar.gz.sig libsodium-1.0.2.tar.gz
    if [ $? -eq 0 ]; then
    tar -xvzf libsodium-1.0.2.tar.gz
    cd libsodium-1.0.2
    ./configure
    make && make check
    make install
    if [ $? -eq 0 ]; then
    cd ..
    rm -rf libsodium-1.0.2
    cd ..
    rmdir tmp
    pecl install channel://pecl.php.net/libsodium-0.1.1
    fi
    # 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-0.1.1
    fi
    fi
    else
    echo -e "\033[31mSignature did not match! Check /tmp/libsodium-1.0.2.tar.gz for trojans\033[0m"
    cd ..
    exit 1
    exit
    fi
    fi
  4. sarciszewski created this gist Jan 18, 2015.
    52 changes: 52 additions & 0 deletions install-libsodium.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    #!/bin/sh

    if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
    fi

    gpg --fingerprint 0x926BC5171CDEA439
    if [ $? -ne 0 ]; then
    echo -e "\033[33mDownloading PGP Public Key...\033[0m"
    gpg --recv-keys 0x926BC5171CDEA439
    # Jedi/Sector One <[email protected]>
    gpg --fingerprint 0x926BC5171CDEA439
    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-0.1.1
    if [ $? -ne 0 ]; then
    # We need to install libsodium
    mkdir tmp
    cd tmp
    if [ ! -f libsodium-1.0.2.tar.gz ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz
    fi
    if [ ! -f libsodium-1.0.2.tar.gz.sig ]; then
    wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.2.tar.gz.sig
    fi

    gpg --verify libsodium-1.0.2.tar.gz.sig libsodium-1.0.2.tar.gz
    if [ $? -eq 0 ]; then
    tar -xvzf libsodium-1.0.2.tar.gz
    cd libsodium-1.0.2
    ./configure
    make && make check
    make install
    if [ $? -eq 0 ]; then
    cd ..
    rm -rf libsodium-1.0.2
    cd ..
    rmdir tmp
    pecl install channel://pecl.php.net/libsodium-0.1.1
    fi
    else
    echo -e "\033[31mSignature did not match! Check /tmp/libsodium-1.0.2.tar.gz for trojans\033[0m"
    cd ..
    exit 1
    fi
    fi