forked from linuxeye/lnmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sourceguardian.sh
49 lines (45 loc) · 1.91 KB
/
sourceguardian.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
#!/bin/bash
# Author: yeho <lj2007331 AT gmail.com>
# BLOG: https://linuxeye.com
#
# Notes: OneinStack for CentOS/RedHat 6+ Debian 8+ and Ubuntu 14+
#
# Project home page:
# https://oneinstack.com
# https://github.com/oneinstack/oneinstack
Install_SourceGuardian() {
if [ -e "${php_install_dir}/bin/phpize" ]; then
pushd ${oneinstack_dir}/src > /dev/null
PHP_detail_ver=`${php_install_dir}/bin/php-config --version`
PHP_main_ver=${PHP_detail_ver%.*}
phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
[ ! -e sourceguardian ] && mkdir sourceguardian
[ -e "loaders.linux-${SYS_BIT_c}.tar.gz" ] && tar xzf loaders.linux-${SYS_BIT_c}.tar.gz -C sourceguardian
if [ -e "sourceguardian/ixed.${PHP_main_ver}.lin" ]; then
[ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
if [ -z "`echo ${phpExtensionDir} | grep 'non-zts'`" ]; then
/bin/mv sourceguardian/ixed.${PHP_main_ver}ts.lin ${phpExtensionDir}
extension="ixed.${PHP_main_ver}ts.lin"
else
/bin/mv sourceguardian/ixed.${PHP_main_ver}.lin ${phpExtensionDir}
extension="ixed.${PHP_main_ver}.lin"
fi
if [ -f "${phpExtensionDir}/ixed.${PHP_main_ver}.lin" ]; then
echo "extension=${extension}" > ${php_install_dir}/etc/php.d/02-sourceguardian.ini
echo "${CSUCCESS}PHP SourceGuardian module installed successfully! ${CEND}"
rm -rf sourceguardian
fi
else
echo; echo "${CWARNING}Your php ${PHP_detail_ver} or platform ${TARGET_ARCH} does not support SourceGuardian! ${CEND}";
fi
popd > /dev/null
fi
}
Uninstall_SourceGuardian() {
if [ -e "${php_install_dir}/etc/php.d/02-sourceguardian.ini" ]; then
rm -f ${php_install_dir}/etc/php.d/02-sourceguardian.ini
echo; echo "${CMSG}PHP SourceGuardian module uninstall completed${CEND}"
else
echo; echo "${CWARNING}PHP SourceGuardian module does not exist! ${CEND}"
fi
}