forked from PopcornTimeCommunity/desktop
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall
executable file
·113 lines (93 loc) · 2.89 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/bash
#Error
func_error() {
[ $error == "0" ] && return 0
echo "
Unexpected Error:
=================
at: $current
... Please try again."
exit 1
}
#Get current architecture
current="1:Set architecture"
if [[ $(uname --machine) == "x86_64" ]] ; then
arch="64" && error=0
elif [[ $(uname --machine) == "i"*"86" ]] ; then
arch="32" && error=0
else
error=1
fi
func_error
#Variables
version="0.4.3-1"
tos="https://popcorntime.sh/tos"
$path="$HOME/.Popcorn-Time-CE"
#Disclaimer
clear
echo "
Popcorn Time CE $version - Linux $arch bits
==================================
Please read our Terms of service:
$tos
This installer will install Popcorn Time CE in:
~/.Popcorn-Time-CE
~/.local/share/applications
~/.local/share/icons
"
{ read -p "Type 'y' and press enter to install : " r </dev/tty ; if [ "$r" != "y" ] || [ ! "$r" ] ; then echo "
Did not get the user agreement. Exiting." && exit 0 ; fi ; }
#if agreed, start install
clear
echo "
Popcorn Time CE $version - Linux $arch bits
=================================="
#extract archive
current="1: Copy files"
echo "
- Copying files to ~/.Popcorn-Time-CE"
mkdir -p "$HOME/.Popcorn-Time-CE"
cp -r * "$HOME/.Popcorn-Time-CE" &> /dev/null && error=0 || error=1
#move icon
mkdir -p "$HOME/.local/share/icons"
cp ./src/app/images/icon.png "$HOME/.local/share/icons/popcorntimece.png" &> /dev/null && error=0 || error=1
func_error
#create .desktop in home
echo "
- Creating new configuration files..."
current="2: Desktop file"
mkdir -p "$HOME/.local/share/applications"
echo "[Desktop Entry]
Comment=Watch Movies and TV Shows instantly
Name=Popcorn Time CE
Exec=$HOME/.Popcorn-Time-CE/Popcorn-Time-CE
Icon=popcorntimece.png
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
StartupNotify=false
Categories=AudioVideo;Video;Network;Player;P2P;
Type=Application" > "$HOME/.local/share/applications/Popcorn-Time-CE.desktop" && error=0 || error=1
func_error
# Work-around for missing libudev.so.1 on Ubuntu 12.04
#if [ ! -e /lib/$(uname --machine)-linux-gnu/libudev.so.1 ]; then
# ln -s /lib/$(uname --machine)-linux-gnu/libudev.so.0 $HOME/.Popcorn-Time/libudev.so.1
# sed -i 's,Exec=,Exec=env LD_LIBRARY_PATH='"$HOME"'/.Popcorn-Time-CE ,g' $HOME/.local/share/applications/Popcorn-Time-CE.desktop
#fi
#chmod .desktop
current="3: Chmod files"
chmod +x "$HOME/.Popcorn-Time-CE/Popcorn-Time-CE" &> /dev/null && error=0 || error=1
chmod +x "$HOME/.local/share/applications/Popcorn-Time-CE.desktop" &> /dev/null && error=0 || error=1
func_error
#uninstaller
echo "How to uninstall Popcorn Time ?
===============================
1) Main application:
- Delete ~/.Popcorn-Time-CE
- Delete ~/.local/share/applications/Popcorn-Time-CE.desktop
- Delete ~/.local/share/icons/popcorntimece.png
2) Configuration files and databases:
- Delete ~/.config/Popcorn-Time" > "$HOME/.Popcorn-Time-CE/Uninstall.txt"
#installation success
echo "
Popcorn Time is now installed in:
«$HOME/.Popcorn-Time-CE»
"