-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.sh
executable file
·101 lines (65 loc) · 2.09 KB
/
index.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
#!/bin/bash
#Próximos passos:
#Listar as versões do PHP que estão instaladas.
#Iniciar um projeto default com auto load e possíbilidade de criar e delclarar rotas.
#Mensagem de Ajuda
MENSAGEM_AJUDA="
$0 [arguments] [options]
[arguments]
-h show help informations .
--help show help informations .
--uninstall-php uninstall PHP .
--install-php install PHP .
Version of the PHP, exemples:
$(basename "$0") --install-php [version of the release]
$(basename "$0") --uninstall-php [version of the release]
$(basename "$0") --uninstall-php ou --install-php sem indicar o versão irá instalar ou desinstalar a versão LTS mais recente.
[options]
"
PHP_LATEST=$(sudo apt-cache policy php | grep "Candidate: [0-9]:[0-9][.][0-9]" | tr : \\t | grep -oE '[0-9]\.[0-9]' | head -n 1)
COMPOSER_INTALL=$(composer -V | grep -oE "Composer version")
case "$1" in
"--help" | "-h")
echo "$MENSAGEM_AJUDA"
exit 0
;;
"--install-php")
if test -n "$2"
then
./PHP/Install\ PHP/installphp74.sh $2 --install
if test $COMPOSER_INTALL != "Composer version"
then
./Composer/installer-composer.sh
fi
else
./PHP/Install\ PHP/installphp74.sh $PHP_LATEST --install
if test $COMPOSER_INTALL != "Composer version"
then
./Composer/installer-composer.sh
fi
fi
;;
"--uninstall-php")
if test -n "$2"
then
./PHP/Install\ PHP/installphp74.sh $2 --purge
if test $COMPOSER_INTALL = "Composer version"
then
sudo apt purge --auto-remove composer
fi
else
./PHP/Install\ PHP/installphp74.sh $PHP_LATEST --purge
if test $COMPOSER_INTALL = "Composer version"
then
sudo apt purge --auto-remove composer
fi
fi
;;
*)
if test -n "$1"
then
echo $(basename "$0")
echo "Opção $1 invallida."
fi
;;
esac