Skip to content

Instantly share code, notes, and snippets.

@nicolasmendoza
Forked from ribtoks/popcorn-installer.sh
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save nicolasmendoza/b51ed061fa1f34832ef3 to your computer and use it in GitHub Desktop.

Select an option

Save nicolasmendoza/b51ed061fa1f34832ef3 to your computer and use it in GitHub Desktop.

Revisions

  1. Nicolas Mendoza revised this gist Jun 14, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion popcorn-installer.sh
    Original file line number Diff line number Diff line change
    @@ -47,7 +47,7 @@ sudo npm install -g grunt-cli && echo -e "...Ok.\n"

    #git clone
    echo "- Cloning GITHUB repository..."
    git clone https://github.com/time4popcorn/popcorntime-desktop && echo -e "...Ok.\n"
    git clone https://git.popcorntime.io/popcorntime/desktop.git popcorntime-desktop && echo -e "...Ok.\n"

    #check architecture
    if [ -n "`arch | grep 64`" ] ; then
  2. Taras Kushnir created this gist Apr 20, 2014.
    129 changes: 129 additions & 0 deletions popcorn-installer.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,129 @@
    #!/bin/bash
    # Script author: MrVaykadji http://askubuntu.com/users/176689/mrvaykadji
    # Changes made by Ribtoks
    # - simulink for compass2.0 in /usr/bin/
    # - replaced apt commands with zypper commands
    # Changes made by Andrew <[email protected]>:
    # - use the NodeJS PPA to avoid build failure with grunt-cli
    # - use the Popcorn Time icon
    # - added check for apt, dpkg, etc.
    # - added some checks when creating symbolic links
    # - added video playback work-around for Ubuntu 32bit
    # - latest GIT requires ruby-compass
    # - build app CSS with ruby compass and place it in the correct folder
    # - it's no longer needed to replace the package.json file
    # - new way of selecting the architecture to build the app for
    # - added installation of compass via gem for Ubuntu 12.04 because the ruby-compass package from Precise is too old and causes the css compilation to fail

    #information
    echo "
    Popcorn-Time Beta 2 for openSUSE
    ------------------------------------
    WARNING: Popcorn Time streams movies from Torrents. Downloading copyrighted material may be illegal in your country. Use at your own risk.
    "

    #verify awareness
    read -p "Do you wish to install Popcorn Time [y/n] ? "
    if [ "$REPLY" == "y" ] ; then
    sudo echo -e "\nThis may take a while...\n"
    else
    exit 0
    fi

    #dependencies install
    #checkAPT
    echo "- Installing dependencies from repositories..."

    sudo zypper in git
    sudo zypper in wget
    sudo zypper in nodejs
    sudo gem install compass
    # compass simulink for grunt
    sudo ln -s /usr/bin/compass2.0 /usr/bin/compass

    #npm install for CLI
    echo "- Installing CLI from 'npm'..."
    sudo npm install -g grunt-cli && echo -e "...Ok.\n"

    #git clone
    echo "- Cloning GITHUB repository..."
    git clone https://github.com/time4popcorn/popcorntime-desktop && echo -e "...Ok.\n"

    #check architecture
    if [ -n "`arch | grep 64`" ] ; then
    #64bits
    ARCH=linux64
    else
    #32bits
    ARCH=linux32
    fi

    #repair broken nodejs symlink
    if [ ! -e /usr/bin/node ]; then
    sudo ln -s /usr/bin/nodejs /usr/bin/node
    fi

    #install NPM dependencies
    cd popcorntime-desktop/
    echo "- Installing NPM dependencies..."
    sudo npm install && echo -e "...Ok.\n"

    #build with grunt
    echo "- Building with 'grunt'..."
    sudo grunt build --platforms=$ARCH && echo -e "...Ok.\n"

    #libudev0 fix
    cd build/releases/Popcorn-Time/$ARCH/
    if [ ! -e /lib/x86_64-linux-gnu/libudev.so.0 ] && [ ! -e /lib/i386-linux-gnu/libudev.so.0 ]; then
    sudo sed -i 's/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x30/\x75\x64\x65\x76\x2E\x73\x6F\x2E\x31/g' Popcorn-Time/Popcorn-Time
    fi

    #Copy program into /opt
    echo "- Installing Popcorn-Time in '/opt/Popcorn-Time/'"
    sudo mkdir -p /opt
    sudo cp -rf Popcorn-Time /opt
    sudo chmod +x /opt/Popcorn-Time/Popcorn-Time
    sudo rm -f "/usr/bin/popcorn-time"
    sudo ln -s /opt/Popcorn-Time/Popcorn-Time /usr/bin/popcorn-time && echo -e "...Ok.\n"

    #fixing playback on 32bit
    if [ "$ARCH" == "linux32" ] ; then
    sudo rm -f "/opt/Popcorn-Time/libffmpegsumo.so"
    wget https://github.com/hotice/webupd8/raw/master/libffmpegsumo.so -O /tmp/libffmpegsumo.so
    sudo cp -f /tmp/libffmpegsumo.so /opt/Popcorn-Time/
    fi

    #testing app
    echo "The application 'Popcorn-Time' will now be tested for 7 secondes.
    "
    Popcorn-Time/Popcorn-Time &
    sleep 7
    killall Popcorn-Time
    read -p "
    Did you see the Popcorn-Time application ?
    If yes, do you wish to remove all the unecessary files now that the program works [y/n] ? "
    if [ "$REPLY" == "y" ] ; then
    #remove building files
    echo "- Removing building files now unwanted..."
    cd ../../../../..
    sudo rm -rf popcorntime-desktop ~/tmp ~/.npm && echo -e "...Ok.\n"
    fi

    #create launcher
    echo "- Creating launcher/shortcut in '/usr/share/applications/'..."
    wget https://github.com/hotice/webupd8/raw/master/popcorntime.png -O /tmp/popcorntime.png
    sudo cp -f /tmp/popcorntime.png /usr/share/pixmaps/
    echo "[Desktop Entry]
    Comment=Watch movies in streaming with P2P.
    Name=Popcorn Time
    Exec=/usr/bin/popcorn-time
    StartupNotify=false
    Type=Application
    Icon=popcorntime" | sudo tee /usr/share/applications/popcorn-time.desktop
    sudo chmod +x /usr/share/applications/popcorn-time.desktop && echo -e "...Ok.\n"

    echo "
    Installation done ! Popcorn-time should be now available through :
    - Commandline 'popcorn-time'"

    exit 0