Commit 3346c3c7 authored by Ed Reel's avatar Ed Reel

Correct install location of nginx

- Enhance startnginx and stopnginx scripts
- Add messages to the postinstall section
- Add instructions to start nginx on login
parent 95ab6d76
...@@ -3,7 +3,7 @@ require 'package' ...@@ -3,7 +3,7 @@ require 'package'
class Nginx < Package class Nginx < Package
description 'nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev.' description 'nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev.'
homepage 'http://nginx.org/' homepage 'http://nginx.org/'
version '1.13.6' version '1.13.6-1'
source_url 'https://nginx.org/download/nginx-1.13.6.tar.gz' source_url 'https://nginx.org/download/nginx-1.13.6.tar.gz'
source_sha256 '8512fc6f986a20af293b61f33b0e72f64a72ea5b1acbcc790c4c4e2d6f63f8f8' source_sha256 '8512fc6f986a20af293b61f33b0e72f64a72ea5b1acbcc790c4c4e2d6f63f8f8'
...@@ -16,7 +16,7 @@ class Nginx < Package ...@@ -16,7 +16,7 @@ class Nginx < Package
def self.build def self.build
system './configure', system './configure',
"--prefix=#{CREW_PREFIX}" "--prefix=#{CREW_PREFIX}/share/nginx"
system 'make' system 'make'
end end
...@@ -24,25 +24,52 @@ class Nginx < Package ...@@ -24,25 +24,52 @@ class Nginx < Package
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
system "mkdir -p #{CREW_DEST_PREFIX}/bin" system "mkdir -p #{CREW_DEST_PREFIX}/bin"
FileUtils.cd("#{CREW_DEST_PREFIX}/bin") do FileUtils.cd("#{CREW_DEST_PREFIX}/bin") do
system "ln -s #{CREW_PREFIX}/nginx/sbin/nginx nginx" system "ln -s #{CREW_PREFIX}/share/nginx/sbin/nginx nginx"
system "echo '#!/bin/bash' > startnginx" system "echo '#!/bin/bash' > startnginx"
system "echo 'sudo nginx' >> startnginx" system "echo 'NGINX=\$(ps ax | grep \"nginx: master process\" | grep -v grep | cut -d\" \" -f1 2> /dev/null)' >> startnginx"
system "echo 'if [ -z \"\$NGINX\" ]; then' >> startnginx"
system "echo ' sudo nginx' >> startnginx"
system "echo 'fi' >> startnginx"
system "echo 'NGINX=\$(ps ax | grep \"nginx: master process\" | grep -v grep | cut -d\" \" -f1 2> /dev/null)' >> startnginx"
system "echo 'if [ ! -z \"\$NGINX\" ]; then' >> startnginx"
system "echo ' echo \"nginx process \$NGINX is running\"' >> startnginx"
system "echo 'else' >> startnginx"
system "echo ' echo \"nginx failed to start\"' >> startnginx"
system "echo 'fi' >> startnginx"
system "echo '#!/bin/bash' > stopnginx" system "echo '#!/bin/bash' > stopnginx"
system "echo 'sudo nginx -s quit' >> stopnginx" system "echo 'NGINX=\$(ps ax | grep \"nginx: master process\" | grep -v grep | cut -d\" \" -f1 2> /dev/null)' >> stopnginx"
system "echo 'if [ ! -z \"\$NGINX\" ]; then' >> stopnginx"
system "echo ' sudo nginx -s quit' >> stopnginx"
system "echo 'fi' >> stopnginx"
system "echo 'NGINX=\$(ps ax | grep \"nginx: master process\" | grep -v grep | cut -d\" \" -f1 2> /dev/null)' >> stopnginx"
system "echo 'if [ -z \"\$NGINX\" ]; then' >> stopnginx"
system "echo ' echo \"nginx process stopped\"' >> stopnginx"
system "echo 'else' >> stopnginx"
system "echo ' echo \"nginx process \$NGINX is running\"' >> stopnginx"
system "echo 'fi' >> stopnginx"
system "chmod +x st*nginx" system "chmod +x st*nginx"
end end
end
def self.postinstall
puts puts
puts "All things NGINX are in #{CREW_PREFIX}/nginx.".lightblue puts "All things NGINX are in #{CREW_PREFIX}/share/nginx.".lightblue
puts puts
puts "Pages are stored in #{CREW_PREFIX}/nginx/html.".lightblue puts "Pages are stored in #{CREW_PREFIX}/share/nginx/html.".lightblue
puts puts
puts "Added bash scripts so you can easily start/stop nginx:".lightblue puts "To start/stop nginx, execute the following:".lightblue
puts "startnginx - starts nginx".lightblue puts "startnginx - starts nginx".lightblue
puts "stopnginx - stops nginx".lightblue puts "stopnginx - stops nginx".lightblue
puts puts
puts "To start nginx on login, execute the following:".lightblue
puts "echo 'if [ -f #{CREW_PREFIX}/bin/startnginx ]; then' >> ~/.bashrc".lightblue
puts "echo ' #{CREW_PREFIX}/bin/startnginx' >> ~/.bashrc".lightblue
puts "echo 'fi' >> ~/.bashrc".lightblue
puts "source ~/.bashrc".lightblue
puts
puts "To completely remove nginx, perform the following:".lightblue puts "To completely remove nginx, perform the following:".lightblue
puts "crew remove nginx".lightblue puts "crew remove nginx".lightblue
puts "sudo rm -rf #{CREW_PREFIX}/nginx".lightblue puts "sudo rm -rf #{CREW_PREFIX}/share/nginx".lightblue
puts puts
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment