Skip to content

Instantly share code, notes, and snippets.

@Thimoteus
Created May 15, 2014 11:47
Show Gist options
  • Save Thimoteus/b1a71aba61380e7ca2e8 to your computer and use it in GitHub Desktop.
Save Thimoteus/b1a71aba61380e7ca2e8 to your computer and use it in GitHub Desktop.
Install Popcorn Time on Ubuntu
#!/bin/bash
##############
# PRELIMINARIES
##############
user=$(id -u)
INSTALL_PATH="$HOME/Popcorn-Time"
DESKTOP_PATH="$HOME/.local/share/applications"
ICON_PATH="$HOME/.local/share/icons/hicolor/256x256/apps"
if [ "$user" -eq "0" ]; then
INSTALL_PATH="/opt/Popcorn-Time"
DESKTOP_PATH="/usr/share/applications"
ICON_PATH="/usr/share/icons/hicolor/256x256/apps"
echo "User is root. Installing to $INSTALL_PATH"
fi
mkdir -p $INSTALL_PATH $DESKTOP_PATH $ICON_PATH
TMP="TMP"
mkdir $TMP
cd $TMP # .../TMP/
##############
# DOWNLOAD
##############
echo "Downloading Popcorn Time ... "
wget https://0d4761a651e048a99d86d5ee11d70ea2.objectstore.eu/releases/Popcorn-Time-0.3.0-Linux-64.tar.gz \
-O Popcorn-Time.tar.gz
echo " ... done."
##############
# UNZIP
##############
tar -zxvf Popcorn-Time.tar.gz
cd Popcorn-Time # .../TMP/Popcorn-Time
##############
# INSTALL
##############
echo "Installing Popcorn Time to $INSTALL_PATH ... "
cp * $INSTALL_PATH
echo "... done."
mkdir $TMP
cp package.nw $TMP/package.zip
cd $TMP # .../TMP/Popcorn-Time/TMP
unzip package.zip
mv src/app/images/icon.png $ICON_PATH/Popcorn-Time.png
gtk-update-icon-cache
##############
# CREATE DESKTOP ENTRY
##############
echo "Creating desktop entry ... "
echo "[Desktop Entry]
Name=Popcorn Time
Comment=Watch torrent movies instantly
Exec=$INSTALL_PATH/Popcorn-Time
Type=Application
Categories=AudioVideo;Video;Player;TV;
Icon=Popcorn-Time" > $DESKTOP_PATH/Popcorn-Time.desktop
echo "... done."
##############
# CREATE UNINSTALL FILE
##############
echo "Creating uninstall file ... "
echo "#!/bin/bash
rm $DESKTOP_PATH/Popcorn-Time.desktop
rm $ICON_PATH/Popcorn-Time.png
rm -rf $INSTALL_PATH" > $INSTALL_PATH/uninstall
chmod +x $INSTALL_PATH/uninstall
echo "... done. Uninstall file can be found in $INSTALL_PATH"
##############
# CLEAN UP
##############
cd ../../..
echo "Cleaning up everything else ... "
rm -rf $TMP
echo "... done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment