Skip to content

Instantly share code, notes, and snippets.

@mazgi
Created September 1, 2012 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazgi/3567127 to your computer and use it in GitHub Desktop.
Save mazgi/3567127 to your computer and use it in GitHub Desktop.
capでディストリビューション判別
distribution={}
task :get_dist do
run "test -f /etc/redhat-release && cat /etc/redhat-release || true" do |channel, stream, data|
if data
release = data.split ' '
distribution[:type] = release[0].to_sym
distribution[:version] = release[2].to_f
end
end
run "test -f /etc/debian_version && cat /etc/debian_version || true" do |channel, stream, data|
if data
distribution[:type] = :Debian
distribution[:version] = data.to_f
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment