forked from skurudo/phpmyadmin-fixer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pma.sh
60 lines (54 loc) · 1.48 KB
/
pma.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
#!/bin/bash
#
# phpmyadmin-fixer
#
# Fixes for phpmyadmin (configuration storage and some extended features)
#
# If you're tired from message - "The phpMyAdmin configuration storage
# is not completely configured, some extended features have been deactivated",
# this patch for you ;-)
#
#
# https://github.com/skurudo/phpmyadmin-fixer
# Author - Pavel Galkin (https://skurudo.ru)
#
# Code for OS check / admin check / check curl/wget
# by Serghey Rodin (https://vestacp.com) from (https://github.com/serghey-rodin/vesta/)
#
# ...
#
# root check
if [ "x$(id -u)" != 'x0' ]; then
echo 'Error: this script can only be executed by root'
exit 1
fi
# Detect OS
case $(head -n1 /etc/issue | cut -f 1 -d ' ') in
Debian) type="debian" ;;
Ubuntu) type="ubuntu" ;;
CentOS) type="centos" ;;
*) type="centos" ;;
esac
# Check wget
if [ -e '/usr/bin/wget' ]; then
wget --no-check-certificate https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-$type.sh -O pma-$type.sh
if [ "$?" -eq '0' ]; then
bash pma-$type.sh $*
exit
else
echo "Error: pma-$type.sh download via wget failed."
exit 1
fi
fi
# Check curl
if [ -e '/usr/bin/curl' ]; then
curl -O -k https://raw.githubusercontent.com/skurudo/phpmyadmin-fixer/master/pma-$type.sh
if [ "$?" -eq '0' ]; then
bash pma-$type.sh $*
exit
else
echo "Error: pma-$type.sh download via curl failed."
exit 1
fi
fi
exit