This repository has been archived by the owner on Nov 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·79 lines (70 loc) · 2.64 KB
/
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
#!/bin/sh
# install.sh - instalador do BatService
# This file is part of BatService.
#
# BatService is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BatService is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BatService. If not, see <https://www.gnu.org/licenses/>.
if [ $(id -u) -eq 0 ]; then
echo "O BatService não pode ser instalado no Termux em modo root!"
exit 1
fi
install_file() {
if [ ! -d "$2" ]; then
mkdir -p "$2"
e=$?
if [ $e -ne 0 ]; then
echo "Não foi possível criar o diretório \"$2\"!"
exit $e
fi
fi
echo "Copiando \"$1\" em \"$2\"..."
cp "$1" "$2"
e=$?
if [ $e -ne 0 ]; then
echo "Falha ao copiar!"
exit $e
fi
}
echo "Instalando BatService..."
install_file lib/perms.sh $PREFIX/lib/batservice/
install_file lib/error.sh $PREFIX/lib/batservice/
install_file lib/config.sh $PREFIX/lib/batservice/
install_file lib/battery.sh $PREFIX/lib/batservice/
install_file lib/notify.sh $PREFIX/lib/batservice/
chmod +x $PREFIX/lib/batservice/notify.sh
install_file lib/env.rc $PREFIX/lib/batservice/
install_file lib/consts.sh $PREFIX/lib/batservice/
install_file lib/log.sh $PREFIX/lib/batservice/
install_file lib/events.sh $PREFIX/lib/batservice/
boot_file=$(ls $HOME/.termux/boot/batservice-*.sh 2>/dev/null)
expected_boot_file="$HOME/.termux/boot/batservice-termux.sh"
if ( [ -n "$boot_file" ] && [ "$boot_file" != "$expected_boot_file" ] ); then
echo "ATUALIZE O BOOT DO NOTIFY QUE VOCÊ INSTALOU!"
echo "Pressione ENTER para continuar..."
read none
else
install_file tools/batservice-termux.sh $HOME/.termux/boot/
chmod +x $HOME/.termux/boot/batservice-termux.sh
fi
install_file COPYING $PREFIX/share/batservice/
echo "Instalando executável"
cp service.sh $PREFIX/bin/batservice.sh
chmod +x $PREFIX/bin/batservice.sh
echo " Este programa é software livre: isto significa que você "
echo " pode usar, alterar, redistribuir ou vender (exceto "
echo " modificações!). Você pode ler os termos da Licença Pública "
echo " Geral GNU executando: 'less $PREFIX/share/batservice/COPYING'"
echo
echo "Instalação concluída."
echo "Reinicie o sistema Android se o BatService não entrar em execução."
echo "by cleds.upper"