forked from moeYuiYui/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upgrade.sh
executable file
·96 lines (88 loc) · 2.93 KB
/
upgrade.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
#!/usr/bin/env bash
export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script"
exit 1
fi
cur_dir=$(pwd)
action=$1
shopt -s extglob
Upgrade_Date=$(date +"%Y%m%d%H%M%S")
. lnmp.conf
. include/version.sh
. include/main.sh
. include/init.sh
. include/php.sh
. include/nginx.sh
. include/mysql.sh
. include/mariadb.sh
. include/upgrade_nginx.sh
. include/upgrade_php.sh
. include/upgrade_mysql.sh
. include/upgrade_mariadb.sh
. include/upgrade_mysql2mariadb.sh
. include/upgrade_phpmyadmin.sh
. include/upgrade_mphp.sh
Get_Dist_Name
Get_Dist_Version
MemTotal=$(awk '/MemTotal/ {printf( "%d\n", $2 / 1024 )}' /proc/meminfo)
Display_Upgrade_Menu()
{
echo "1: Upgrade Nginx"
echo "2: Upgrade MySQL"
echo "3: Upgrade MariaDB"
echo "4: Upgrade PHP for LNMP"
echo "5: Upgrade PHP for LNMPA or LAMP"
echo "6: Upgrade MySQL to MariaDB"
echo "7: Upgrade phpMyAdmin"
echo "8: Upgrade Multiple PHP"
echo "exit: Exit current script"
echo "###################################################"
read -p "Enter your choice (1, 2, 3, 4, 5, 6, 7 or exit): " action
}
clear
echo "+-----------------------------------------------------------------------+"
echo "| Upgrade script for LNMP V2.1, Written by Licess |"
echo "+-----------------------------------------------------------------------+"
echo "| A tool to upgrade Nginx,MySQL/Mariadb,PHP for LNMP/LNMPA/LAMP |"
echo "+-----------------------------------------------------------------------+"
echo "| For more information please visit https://lnmp.org |"
echo "+-----------------------------------------------------------------------+"
if [ "${action}" == "" ]; then
Display_Upgrade_Menu
fi
case "${action}" in
1|[nN][gG][iI][nN][xX])
Upgrade_Nginx 2>&1 | tee /root/upgrade_nginx${Upgrade_Date}.log
;;
2|[mM][yY][sS][qQ][lL])
Upgrade_MySQL 2>&1 | tee /root/upgrade_mysq${Upgrade_Date}.log
;;
3|[mM][aA][rR][iI][aA][dD][bB])
Upgrade_MariaDB 2>&1 | tee /root/upgrade_mariadb${Upgrade_Date}.log
;;
4|[pP][hP][pP])
Stack="lnmp"
Upgrade_PHP 2>&1 | tee /root/upgrade_lnmp_php${Upgrade_Date}.log
;;
5|[pP][hP][pP][aA])
Upgrade_PHP 2>&1 | tee /root/upgrade_a_php${Upgrade_Date}.log
;;
6|[mM]2[mY])
Upgrade_MySQL2MariaDB 2>&1 | tee /root/upgrade_mysql2mariadb${Upgrade_Date}.log
;;
7|[pP][hH][pP][mM][yY][aA][dD][mM][iI][nN])
Upgrade_phpMyAdmin 2>&1 | tee /root/upgrade_phpmyadmin${Upgrade_Date}.log
;;
8|[mM][pP][hH][pP])
Upgrade_Multiplephp 2>&1 | tee /root/upgrade_mphp${Upgrade_Date}.log
;;
[eE][xX][iI][tT])
exit 1
;;
*)
echo "Usage: ./upgrade.sh {nginx|mysql|mariadb|m2m|php|phpa|phpmyadmin}"
exit 1
;;
esac