forked from couchone/build-couchdb
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'origin/plugins'
- Loading branch information
Showing
7 changed files
with
191 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,5 @@ | ||
|
||
task :known_distro => [ :known_mac, :known_ubuntu, :known_debian, :known_redhat, :known_opensuse, :known_slf, :known_solaris ] do | ||
raise 'Unknown distribution, build not supported' unless Object.const_defined? 'DISTRO' | ||
end | ||
|
||
task :known_mac do | ||
DISTRO = [:osx, 10.0] if `uname`.chomp == 'Darwin' | ||
end | ||
|
||
task :known_ubuntu do | ||
if File.exist? '/etc/lsb-release' | ||
info = Hash[ *File.new('/etc/lsb-release').lines.map{ |x| x.split('=').map { |y| y.chomp } }.flatten ] | ||
if info['DISTRIB_ID'] == 'Ubuntu' | ||
DISTRO = [:ubuntu, info['DISTRIB_RELEASE']] | ||
end | ||
end | ||
end | ||
|
||
task :known_debian do | ||
ver = '/etc/debian_version' | ||
DISTRO = [:debian, File.new(ver).readline.chomp] if !File.exist?('/etc/lsb-release') && File.exist?(ver) | ||
end | ||
|
||
task :known_redhat do | ||
if File.exist? '/etc/fedora-release' | ||
release = File.new('/etc/fedora-release').readline.match(/Fedora release (\d+)/)[1] | ||
DISTRO = [:fedora, release] | ||
end | ||
if File.exist? '/etc/redhat-release' | ||
release = File.new('/etc/redhat-release').readline.match(/Red Hat Enterprise Linux Server release (\d+)/)[1] | ||
DISTRO = [:fedora, release] | ||
end | ||
end | ||
|
||
task :known_slf do | ||
if File.exist? '/etc/redhat-release' | ||
release = File.new('/etc/redhat-release').readline.match(/Scientific Linux SLF release (\d+)/)[1] | ||
DISTRO = [:slf, release] | ||
|
||
if RUBY_VERSION <= '1.8.7' | ||
raise 'Version of ruby is too old. Consider installing a more recent version' | ||
end | ||
end | ||
end | ||
|
||
task :known_opensuse do | ||
if File.exist? '/etc/SuSE-release' | ||
release = File.new('/etc/SuSE-release').readline.match(/openSUSE (\d+)/)[1] | ||
DISTRO = [:opensuse, release] | ||
end | ||
end | ||
|
||
task :known_solaris do | ||
if `uname`.chomp == "SunOS" | ||
DISTRO = [:solaris, `uname -r`.chomp] | ||
end | ||
task :known_distro do | ||
distro = detect_distro() | ||
raise 'Unknown distribution, build not supported' unless distro | ||
DISTRO = distro | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Distribution (platform) detection | ||
|
||
def detect_distro | ||
# OSX | ||
if `uname`.chomp == 'Darwin' | ||
return [:osx, 10.0] | ||
end | ||
|
||
# Solaris | ||
if `uname`.chomp == "SunOS" | ||
return [:solaris, `uname -r`.chomp] | ||
end | ||
|
||
# Ubuntu | ||
if File.exist? '/etc/lsb-release' | ||
info = Hash[ *File.new('/etc/lsb-release').lines.map{ |x| x.split('=').map { |y| y.chomp } }.flatten ] | ||
if info['DISTRIB_ID'] == 'Ubuntu' | ||
return [:ubuntu, info['DISTRIB_RELEASE']] | ||
end | ||
end | ||
|
||
# Debian | ||
ver = '/etc/debian_version' | ||
return [:debian, File.new(ver).readline.chomp] if !File.exist?('/etc/lsb-release') && File.exist?(ver) | ||
|
||
# Fedora | ||
if File.exist? '/etc/fedora-release' | ||
release = File.new('/etc/fedora-release').readline.match(/Fedora release (\d+)/)[1] | ||
return [:fedora, release] | ||
end | ||
|
||
# Red Hat | ||
if File.exist? '/etc/redhat-release' | ||
release = File.new('/etc/redhat-release').readline.match(/Red Hat Enterprise Linux Server release (\d+)/)[1] | ||
return [:fedora, release] | ||
end | ||
|
||
# Scientific Linux | ||
if File.exist? '/etc/redhat-release' | ||
release = File.new('/etc/redhat-release').readline.match(/Scientific Linux SLF release (\d+)/)[1] | ||
return [:slf, release] | ||
|
||
if RUBY_VERSION <= '1.8.7' | ||
raise 'Version of ruby is too old. Consider installing a more recent version' | ||
end | ||
end | ||
|
||
# OpenSUSE | ||
if File.exist? '/etc/SuSE-release' | ||
release = File.new('/etc/SuSE-release').readline.match(/openSUSE (\d+)/)[1] | ||
return [:opensuse, release] | ||
end | ||
|
||
nil | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters