demo.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # BLOG: https://linuxeye.com
  4. #
  5. # Notes: OneinStack for CentOS/RedHat 7+ Debian 9+ and Ubuntu 16+
  6. #
  7. # Project home page:
  8. # https://oneinstack.com
  9. # https://github.com/oneinstack/oneinstack
  10. DEMO() {
  11. pushd ${oneinstack_dir}/src > /dev/null
  12. if [ ! -e ${wwwroot_dir}/default/index.html ]; then
  13. [ "${OUTIP_STATE}"x == "China"x ] && /bin/cp ${oneinstack_dir}/config/index_cn.html ${wwwroot_dir}/default/index.html || /bin/cp ${oneinstack_dir}/config/index.html ${wwwroot_dir}/default
  14. fi
  15. if [ -e "${php_install_dir}/bin/php" ]; then
  16. src_url=${mirror_link}/oneinstack/src/xprober.php && Download_src
  17. /bin/cp xprober.php ${wwwroot_dir}/default
  18. echo "<?php phpinfo() ?>" > ${wwwroot_dir}/default/phpinfo.php
  19. case "${phpcache_option}" in
  20. 1)
  21. src_url=${mirror_link}/oneinstack/src/ocp.php && Download_src
  22. /bin/cp ocp.php ${wwwroot_dir}/default
  23. ;;
  24. 2)
  25. sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/apc.php" target="_blank" class="links">APC</a>@' ${wwwroot_dir}/default/index.html
  26. ;;
  27. 3)
  28. sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/xcache" target="_blank" class="links">xcache</a>@' ${wwwroot_dir}/default/index.html
  29. ;;
  30. 4)
  31. /bin/cp eaccelerator-*/control.php ${wwwroot_dir}/default
  32. sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@<a href="/control.php" target="_blank" class="links">eAccelerator</a>@' ${wwwroot_dir}/default/index.html
  33. ;;
  34. *)
  35. sed -i 's@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@@' ${wwwroot_dir}/default/index.html
  36. ;;
  37. esac
  38. fi
  39. chown -R ${run_user}:${run_group} ${wwwroot_dir}/default
  40. [ -e /bin/systemctl ] && systemctl daemon-reload
  41. popd > /dev/null
  42. }