-
Notifications
You must be signed in to change notification settings - Fork 7
/
popcorntime-install.sh
executable file
·128 lines (120 loc) · 3.38 KB
/
popcorntime-install.sh
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#02/12/2015 - última atualização 13/02/2017
#script irá fazer a instalação do programa Popcorntime manualmente
#sem a adição de PPA's
#
#por Flávio Oliveira
#http://flaviodeoliveira.com.br
#http://youtube.com/flaviodicas
#https://github.com/oliveiradeflavio
if [[ `id -u` -eq 0 ]]; then
echo
echo "Execute esse script sem ser ROOT"
echo "Saindo do script..."
sleep 5
exit
fi
testconnection()
{
echo "Aguarde!!! Verificando conexão com a internet"
if ! ping -c 7 www.google.com.br 1>/dev/null 2>/dev/stdout; then
echo "Alguns módulos desse script precisa de conexão com a internet para serem executado"
sleep 3
read -p "Deseja refazer o teste de conexão? s/n: " -n1 escolha
case $escolha in
s|S) echo
clear
testaconexao
;;
n|N) echo
echo Finalizando script...
sleep 2
exit
;;
*) echo
echo Alternativas incorretas ... Saindo!!!!
sleep 2
exit
;;
esac
else
echo "Teste de conexão está ok"
sleep 1
fi
}
architecture()
{
clear
cd /tmp/
if uname -m | grep '64' 1>/dev/null 2>/dev/stdout; then
echo "Download Popcorntime"
echo
testconnection
wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-64.tar.xz -O popcorntime.tar.xz
mkdir /opt/popcorntime
tar Jxf popcorntime.tar.xz -C /opt/popcorntime/ 1>/dev/null 2>/dev/stdout
ln -sf /opt/popcorntime/Popcorn-Time /usr/bin/Popcorn-Time
echo -e '[Desktop Entry]\n Version=1.0\n Name=popcorntime\n Exec=/opt/popcorntime/Popcorn-Time\n Icon=/opt/popcorntime/src/app/images/icon.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/popcorntime.desktop
chmod +x /usr/share/applications/popcorntime.desktop
cp /usr/share/applications/popcorntime.desktop ~/Área\ de\ Trabalho/
else
echo "Download Popcorntime"
echo
testconnection
wget https://get.popcorntime.sh/build/Popcorn-Time-0.3.10-Linux-32.tar.xz -O popcorntime.tar.xz
mkdir /opt/popcorntime
tar Jxf popcorntime.tar.xz -C /opt/popcorntime/ 1>/dev/null 2>/dev/stdout
ln -sf /opt/popcorntime/Popcorn-Time /usr/bin/Popcorn-Time
echo -e '[Desktop Entry]\n Version=1.0\n Name=popcorntime\n Exec=/opt/popcorntime/Popcorn-Time\n Icon=/opt/popcorntime/src/app/images/icon.png\n Type=Application\n Categories=Application' | sudo tee /usr/share/applications/popcorntime.desktop
chmod +x /usr/share/applications/popcorntime.desktop
cp /usr/share/applications/popcorntime.desktop ~/Área\ de\ Trabalho/
fi
echo
echo "Concluído"
}
verify()
{
clear
echo "Verificando Instalações anteriores..."
echo " Por favor aguarde..."
sleep 2
rm -Rf /opt/popcorntime
rm -Rf /usr/bin/Popcorn-Time
rm -Rf /usr/share/applications/popcorntime.desktop
rm -Rf ~/.Popcorn-Time
rm -Rf ~/.local/share/applications/Popcorn-Time.desktop
rm -Rf ~/.local/share/icons/popcorntime.png
rm -Rf ~/.config/Popcorn-Time
echo "Remoção concluída"
echo
echo "Concluído"
}
clear
echo "Bem vindo"
echo
echo "i) Instalar"
echo
echo "r) Remover"
echo
echo "s) Sair"
echo
read -n1 -p "Escolha i(instalar), r(remover) ou s(sair) " -s escolha
case $escolha in
i|I) echo
echo Analisando sistema
verify ; architecture
;;
r|R) echo
echo Aguarde...
verify
;;
s|S) echo
echo Saindo...
sleep 1 ; exit
;;
*) echo
echo Alternativas incorretas, saindo!
sleep 1
exit
;;
esac