actions.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import perlmodules
  10. from pisi.actionsapi import get
  11. NGINX_HOME = '/var/lib/nginx'
  12. NGINX_PID = '/run/nginx.pid'
  13. NGINX_LOCK = '/run/nginx.lock'
  14. NGINX_CONF = '/etc/nginx/nginx.conf'
  15. NGINX_HTML = '/var/www/nginx'
  16. LOG_DIR = '/var/log/nginx'
  17. ERROR_LOG = '%s/error.log' % LOG_DIR
  18. ACCESS_LOG = '%s/access.log' % LOG_DIR
  19. def setup():
  20. autotools.rawConfigure("--user=nginx \
  21. --group=nginx \
  22. --prefix=%(html)s \
  23. --sbin-path=/usr/sbin/nginx \
  24. --conf-path=%(conf)s \
  25. --pid-path=%(pid)s \
  26. --lock-path=%(lock)s \
  27. --error-log-path=%(error)s \
  28. --http-log-path=%(access)s \
  29. --http-client-body-temp-path=%(home)s/client_body \
  30. --http-proxy-temp-path=%(home)s/proxy \
  31. --http-fastcgi-temp-path=%(home)s/fastcgi \
  32. --with-ipv6 \
  33. --with-http_ssl_module \
  34. --with-http_realip_module \
  35. --with-http_addition_module \
  36. --with-http_xslt_module \
  37. --with-http_image_filter_module \
  38. --with-http_geoip_module \
  39. --with-http_sub_module \
  40. --with-http_dav_module \
  41. --with-http_flv_module \
  42. --with-http_gzip_static_module \
  43. --with-http_stub_status_module \
  44. --with-http_perl_module \
  45. --with-mail \
  46. --with-mail_ssl_module" % {'html': NGINX_HTML, \
  47. 'conf': NGINX_CONF, \
  48. 'pid': NGINX_PID, \
  49. 'lock': NGINX_LOCK, \
  50. 'error': ERROR_LOG, \
  51. 'access': ACCESS_LOG, \
  52. 'home': NGINX_HOME})
  53. def build():
  54. autotools.make()
  55. def install():
  56. autotools.rawInstall("DESTDIR=%s" % get.installDIR())
  57. # For 3rd-party configuration files
  58. pisitools.dodir("/etc/nginx/conf.d")
  59. # Remove empty dir
  60. pisitools.removeDir("/usr/lib/perl5/%s" % get.curPERL())
  61. # Add log dir and touch them :) Nginx needs pre-defined *.log files
  62. pisitools.dodir(LOG_DIR)
  63. shelltools.touch("%s%s" % (get.installDIR(), ERROR_LOG))
  64. shelltools.touch("%s%s" % (get.installDIR(), ACCESS_LOG))
  65. pisitools.dodir(NGINX_HOME + "/client_body")
  66. pisitools.dodir(NGINX_HOME + "/fastcgi")
  67. pisitools.dodir(NGINX_HOME + "/proxy")
  68. # pisitools.remove("/usr/lib/perl5/site_perl/*/*/*/*/.packlist")
  69. pisitools.remove("/etc/nginx/mime.types")
  70. pisitools.dodoc("README", "LICENSE")