mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-10 07:57:59 -05:00
53 lines
2.0 KiB
Ruby
53 lines
2.0 KiB
Ruby
require 'package'
|
|
|
|
class Jdk11 < Package
|
|
description 'The JDK is a development environment for building applications, applets, and components using the Java programming language.'
|
|
homepage 'https://www.oracle.com/java/technologies/javase-jdk11-downloads.html'
|
|
version '11.0.9'
|
|
compatibility 'x86_64'
|
|
case ARCH
|
|
when 'x86_64'
|
|
source_url 'file:///dev/null'
|
|
source_sha256 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
end
|
|
|
|
binary_url ({
|
|
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/jdk11-11.0.9-chromeos-x86_64.tar.xz',
|
|
})
|
|
binary_sha256 ({
|
|
x86_64: 'aa768cfbd031d021d6df4dc5da90db385ac144ea4d6868447a14d2b3ace058b4',
|
|
})
|
|
|
|
case ARGV[0]
|
|
when 'install', 'reinstall'
|
|
abort "JDK8 installed.".lightgreen if Dir.exists? "#{CREW_PREFIX}/share/jdk8"
|
|
end
|
|
|
|
def self.install
|
|
jdk_bin = "#{HOME}/Downloads/jdk-#{version}_linux-x64_bin.tar.gz"
|
|
jdk_sha256 = '5c149faddf9deb5a2f63438e7cd8f7d21e7300c93ebbc43dc83a6e3b90d554a7'
|
|
unless File.exists? jdk_bin then
|
|
puts
|
|
puts "Oracle now requires an account to download the JDK.".orange
|
|
puts
|
|
puts "You must login at https://login.oracle.com/mysso/signon.jsp and then visit:".orange
|
|
puts "https://www.oracle.com/java/technologies/javase-jdk11-downloads.html".orange
|
|
puts
|
|
puts "Download the JDK for your architecture to #{HOME}/Downloads to continue.".orange
|
|
puts
|
|
abort
|
|
end
|
|
abort 'Checksum mismatch. :/ Try again.'.lightred unless Digest::SHA256.hexdigest( File.read(jdk_bin) ) == jdk_sha256
|
|
system "tar xvf #{jdk_bin}"
|
|
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"
|
|
FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/share/jdk11"
|
|
FileUtils.cd "jdk-#{version}" do
|
|
FileUtils.rm_f 'lib/src.zip'
|
|
FileUtils.mv Dir.glob('*'), "#{CREW_DEST_PREFIX}/share/jdk11/"
|
|
end
|
|
FileUtils.cd "#{CREW_DEST_PREFIX}/share/jdk11/bin" do
|
|
system "find -type f -exec ln -s #{CREW_PREFIX}/share/jdk11/bin/{} #{CREW_DEST_PREFIX}/bin/{} \\;"
|
|
end
|
|
end
|
|
end
|