sourceguardian.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://blog.linuxeye.cn
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 6+ Debian 7+ and Ubuntu 12+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. Install_SourceGuardian() {
  11. pushd ${oneinstack_dir}/src > /dev/null
  12. PHP_detail_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`
  13. PHP_main_ver=${PHP_detail_ver%.*}
  14. phpExtensionDir=`${php_install_dir}/bin/php-config --extension-dir`
  15. [ ! -e sourceguardian ] && mkdir sourceguardian
  16. if [ "${TARGET_ARCH}" == "armv8" ]; then
  17. tar xzf loaders.linux-aarch64.tar.gz -C sourceguardian
  18. else
  19. tar xzf loaders.linux-${SYS_BIT_c}.tar.gz -C sourceguardian
  20. fi
  21. [ ! -d "${phpExtensionDir}" ] && mkdir -p ${phpExtensionDir}
  22. if [ -z "`echo ${phpExtensionDir} | grep 'non-zts'`" ]; then
  23. /bin/cp sourceguardian/ixed.${PHP_main_ver}ts.lin ${phpExtensionDir}
  24. extension="ixed.${PHP_main_ver}ts.lin"
  25. else
  26. /bin/cp sourceguardian/ixed.${PHP_main_ver}.lin ${phpExtensionDir}
  27. extension="ixed.${PHP_main_ver}.lin"
  28. fi
  29. if [ -f "${phpExtensionDir}/ixed.${PHP_main_ver}.lin" ]; then
  30. echo "extension=${extension}" > ${php_install_dir}/etc/php.d/02-sourceguardian.ini
  31. rm -rf sourceguardian
  32. fi
  33. popd > /dev/null
  34. }