Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
popcorn time for desktop installer script for linux openSUSE
#!/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 <andrew@webupd8.org>:
# - 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
@MarkoPaasila

This comment has been minimized.

Copy link

MarkoPaasila commented May 13, 2014

row 67 should maybe be "cd popcorntime-desktop/nativeapp/

@bedri

This comment has been minimized.

Copy link

bedri commented Dec 10, 2015

Why the script is asking for github username and password? Are you trying to collect other's username:passwords?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.