panel.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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_Panel() {
  11. pushd ${oneinstack_dir}/../ > /dev/null
  12. git clone https://github.com/oneinstack/panel.git
  13. pushd panel > /dev/null
  14. sed -i "s@/root/oneinstack/options.conf@${oneinstack_dir}/options.conf@" panel/settings.py
  15. ${python_install_dir}/bin/pip3 install -r requirements.txt
  16. ${python_install_dir}/bin/python3 manage.py makemigrations
  17. ${python_install_dir}/bin/python3 manage.py migrate
  18. if [ -e /bin/systemctl ]; then
  19. /bin/cp ${oneinstack_dir}/init.d/panel.service /lib/systemd/system/
  20. sed -i "s@/root/git/repo/panel@`pwd`@g" /lib/systemd/system/panel.service
  21. else
  22. /bin/cp ${oneinstack_dir}/init.d/Panel-init /etc/init.d/panel
  23. sed -i "s@/root/git/repo/panel@`pwd`@g" /etc/init.d/panel
  24. [ "${PM}" == 'yum' ] && { chkconfig --add panel; chkconfig panel on; }
  25. [ "${PM}" == 'apt-get' ] && update-rc.d panel defaults
  26. fi
  27. popd > /dev/null
  28. popd > /dev/null
  29. service panel start
  30. }
  31. Upgrade_Panel() {
  32. pushd ${oneinstack_dir}/../panel > /dev/null
  33. git pull
  34. ${python_install_dir}/bin/pip3 install -r requirements.txt -U
  35. ${python_install_dir}/bin/python3 manage.py makemigrations
  36. ${python_install_dir}/bin/python3 manage.py migrate
  37. popd > /dev/null
  38. service panel reload
  39. }
  40. Uninstall_Panel() {
  41. service panel stop
  42. pushd ${oneinstack_dir}/../ > /dev/null
  43. rm -rf panel
  44. popd > /dev/null
  45. }