nginx-hardened-preferences.install 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. pre_install() {
  2. echo "Cleaning any old chroots before installing a new one..."
  3. if [ -d '/srv/nginxchroot' ]; then
  4. umount /srv/nginxchroot/tmp
  5. umount /srv/nginxchroot/var/run
  6. rm -rf /srv/nginxchroot
  7. fi
  8. }
  9. post_install() {
  10. echo "Installing a new chroot ... "
  11. /bin/sh -c "/usr/libexec/nginx-hardened-scripts/nginxchroot.sh"
  12. wait
  13. echo "Done!"
  14. echo "====="
  15. echo "To use this service please disable nginx,"
  16. echo "then enable nginx-hardened via HyperRC or runit."
  17. echo "====="
  18. }
  19. post_upgrade() {
  20. echo "Stopping chrooted nginx..."
  21. if [ -x /etc/init.d/nginx-hardened ]; then
  22. /etc/init.d/nginx-hardened stop
  23. fi
  24. echo "Cleaning old chroot and putting in a new one..."
  25. if [ -d '/srv/nginxchroot' ]; then
  26. umount /srv/nginxchroot/tmp
  27. umount /srv/nginxchroot/var/run
  28. rm -rf /srv/nginxchroot
  29. fi
  30. wait
  31. /bin/sh -c "/usr/libexec/nginx-hardened-scripts/nginxchroot.sh"
  32. wait
  33. echo "Done!"
  34. echo "====="
  35. echo "To use this service please disable nginx,"
  36. echo "then enable nginx-hardened via HyperRC or runit."
  37. echo "====="
  38. }
  39. pre_remove() {
  40. echo "Stopping chrooted nginx..."
  41. if [ -x /etc/init.d/nginx-hardened ]; then
  42. /etc/init.d/nginx-hardened stop
  43. fi
  44. }
  45. post_remove() {
  46. echo "Deleting chroot..."
  47. if [ -d '/srv/nginxchroot' ]; then
  48. umount /srv/nginxchroot/tmp
  49. umount /srv/nginxchroot/var/run
  50. rm -rf /srv/nginxchroot
  51. fi
  52. wait
  53. echo "Done!"
  54. }