Skip to content

Commit

Permalink
Added 'lamp stack removed' to clean up apt systems before installing …
Browse files Browse the repository at this point in the history
…nginx. (e.g. rimuhosting instances come with a lamp stack preinstalled).
  • Loading branch information
benhoskings committed Jan 18, 2011
1 parent de0a119 commit 268fe91
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nginx.rb
Expand Up @@ -157,7 +157,7 @@ def restart_nginx
end

dep 'webserver installed.src' do
requires 'passenger built', 'pcre.managed', 'libssl headers.managed', 'zlib headers.managed'
requires 'lamp stack removed', 'passenger built', 'pcre.managed', 'libssl headers.managed', 'zlib headers.managed'
merge :versions, {:nginx => '0.8.54', :nginx_upload_module => '2.2.0'}
source "http://nginx.org/download/nginx-#{var(:versions)[:nginx]}.tar.gz"
extra_source "http://www.grid.net.ru/nginx/download/nginx_upload_module-#{var(:versions)[:nginx_upload_module]}.tar.gz"
Expand Down Expand Up @@ -189,3 +189,22 @@ def restart_nginx
end
}
end

dep 'lamp stack removed', :for => :apt do
def packages
shell("dpkg --get-selections | egrep 'apache|mysql|php'").split("\n").map {|l|
l.split(/\s+/, 2).first
}
end
met? {
packages.empty?
}
meet {
packages.each {|pkg|
log_shell "Removing #{pkg}", "apt-get -y remove --purge '#{pkg}'", :sudo => true
}
}
after {
sudo "apt-get -y autoremove"
}
end

0 comments on commit 268fe91

Please sign in to comment.