Commit 4e3ca3dd authored by satmandu's avatar satmandu Committed by GitHub

ca_certificates: Move postinstall logic to install (#5126)

* Move postinstall logic to install

* update patch section, chomping

* remove bash dep
parent e3fa79aa
require 'package'
class Ca_certificates < Package
description 'CA Certificates'
description 'Common CA Certificates PEM files'
homepage 'https://salsa.debian.org/debian/ca-certificates'
@_ver = '20210119'
version @_ver
version "#{@_ver}-1"
compatibility 'all'
source_url "https://salsa.debian.org/debian/ca-certificates/-/archive/debian/#{@_ver}/ca-certificates-debian-#{@_ver}.tar.bz2"
source_sha256 'af30b4d9a2c58e42134067d29f0ba6120e5960fd140393d5574d4bdcf5b824d6'
binary_url ({
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-chromeos-x86_64.tar.xz',
aarch64: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-1-chromeos-armv7l.tar.xz',
armv7l: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-1-chromeos-armv7l.tar.xz',
i686: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-1-chromeos-i686.tar.xz',
x86_64: 'https://dl.bintray.com/chromebrew/chromebrew/ca_certificates-20210119-1-chromeos-x86_64.tar.xz',
})
binary_sha256 ({
aarch64: '75d332ca6053e5e12d34eb5d72da6daab50d650f6733d1bd9668bed9af802e30',
armv7l: '75d332ca6053e5e12d34eb5d72da6daab50d650f6733d1bd9668bed9af802e30',
i686: 'e61ae07f85f64f0c53fa922714ac30579c77db5f2e9fa266e4e6059b502f5475',
x86_64: '7a782fdba9f89b077004dab99c15367bb999ed1b19485e32a22be2e79c4f3ac3',
aarch64: '412f0ca92aaafb7e45543635fdfcda9bf937a8b659d0a10403f4f7e827ddd98f',
armv7l: '412f0ca92aaafb7e45543635fdfcda9bf937a8b659d0a10403f4f7e827ddd98f',
i686: '527721877820f2be4f83e13b3aa3b237e1bf1f3263e636241f122d9c001f9c08',
x86_64: 'f2fa591a9ec3aa7c43a1fd58081f1f6a1b9ef9f8ee4ae0c520b17202648fd395',
})
def self.patch
url_patch1 = 'https://gitweb.gentoo.org/repo/gentoo.git/plain/app-misc/ca-certificates/files/ca-certificates-20150426-root.patch'
filename_patch1 = 'ca-certificates-20150426-root.patch'
sha256sum_patch1 = '0200f41d2c68b5fb0c19783ddd80d806540e136d10f9d4ee4ff3a79b48d70e73'
puts "Downloading #{filename_patch1}".yellow
system('curl', '-s', '-L', '-#', url_patch1, '-o', filename_patch1)
abort 'Checksum mismatch. :/ Try again.'.lightred unless
Digest::SHA256.hexdigest(File.read(filename_patch1)) == sha256sum_patch1
puts filename_patch1 + ' archive downloaded'.lightgreen
system "patch -p 3 < #{filename_patch1}"
system "sed -i 's,/usr/share/ca-certificates,#{CREW_PREFIX}/share/ca-certificates,g' \
Makefile"
system "sed -i 's,/usr/share/ca-certificates,#{CREW_PREFIX}/share/ca-certificates,g' \
......@@ -45,13 +55,18 @@ class Ca_certificates < Package
FileUtils.mkdir_p("#{CREW_DEST_PREFIX}/etc/ssl/certs/")
FileUtils.mkdir_p("#{CREW_DEST_PREFIX}/bin")
FileUtils.mkdir_p("#{CREW_DEST_PREFIX}/share/ca-certificates/")
system "touch #{CREW_DEST_PREFIX}/etc/ca-certificates.conf"
system "make DESTDIR=#{CREW_DEST_DIR} install"
FileUtils.ln_s Dir.glob("#{CREW_PREFIX}/share/ca-certificates/mozilla/*"),
"#{CREW_DEST_PREFIX}/etc/ssl/certs/"
end
def self.postinstall
system 'update-ca-certificates --hooksdir "" --fresh'
@date_temp = `date -v`.chomp
@ca_cert_conf = <<~CA_CERT_CONF_HEREDOC
# Automatically generated by Chromebrew package #{Module.nesting.first}
# from ca-certificates-debian-#{@_ver}
# #{@date_temp}
# Do not edit.
CA_CERT_CONF_HEREDOC
IO.write("#{CREW_DEST_PREFIX}/etc/ca-certificates.conf", @ca_cert_conf)
Dir.chdir "#{CREW_PREFIX}/share/ca-certificates" do
system "find * -name '*.crt' | LC_ALL=C sort | sed '/examples/d' >> #{CREW_DEST_PREFIX}/etc/ca-certificates.conf"
end
system "sbin/update-ca-certificates --hooksdir '' --fresh --certsconf #{CREW_DEST_PREFIX}/etc/ca-certificates.conf"
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