wok-next view cacerts/receipt @ rev 20709
cdrdao: add patch.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat May 26 17:09:29 2018 +0300 (2018-05-26) |
parents | c4e53a39395a |
children | 41860cbdf043 |
line source
1 # SliTaz package receipt v2.
3 # This receipt will follow actual version on each recook
4 PACKAGE="cacerts"
5 VERSION="20180309"
6 CATEGORY="security"
7 SHORT_DESC="Certificate Authority Certificates"
8 MAINTAINER="al.bobylev@gmail.com"
9 LICENSE="MPL2"
10 WEB_SITE="http://www.linuxfromscratch.org/blfs/view/svn/postlfs/cacerts.html"
12 wget_url="https://hg.mozilla.org/releases/mozilla-release/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt"
13 #wget_url="http://anduin.linuxfromscratch.org/BLFS/other/certdata.txt"
15 BUILD_DEPENDS="perl openssl locale-en-base"
17 compile_rules() {
18 # Determine date of certdata.txt
19 # FIXME: please point me to elegant way to determine this file timestamp
20 # in Mercurial.
21 string=$(wget -O- ${wget_url/raw-/} | fgrep 'date age')
22 # string example:
23 # <td class="date age">Thu, 28 Sep 2017 10:02:22 -0700</td>
24 date_d=$(echo "$string" | cut -d' ' -f5)
25 case $(echo "$string" | cut -d' ' -f6) in
26 Jan) date_m='01';;
27 Feb) date_m='02';;
28 Mar) date_m='03';;
29 Apr) date_m='04';;
30 May) date_m='05';;
31 Jun) date_m='06';;
32 Jul) date_m='07';;
33 Aug) date_m='08';;
34 Sep) date_m='09';;
35 Oct) date_m='10';;
36 Nov) date_m='11';;
37 Dec) date_m='12';;
38 esac
39 date_Y=$(echo "$string" | cut -d' ' -f7)
40 date_Ymd="$date_Y$date_m$date_d"
42 [ -f '/tmp/certdata.txt' ] && rm /tmp/certdata.txt
43 wget -P/tmp $wget_url
45 # Insert header (or process will fail)
46 sed -i "1i\
47 #CVS_ID @# \$ RCSfile: certdata.txt \$ \$Revision: $date_Ymd \$ \$Date: \$" \
48 /tmp/certdata.txt
50 # VERSION=$(sed -n '/\$Revision:/s|.*Revision: \([0-9]*\).*$|\1|p' /tmp/certdata.txt)
51 VERSION="$date_Ymd"
52 echo -e "\nActual version: $VERSION\n"
54 # Update receipt version
55 sed -i "s|^VERSION=.*|VERSION=\"$VERSION\"|" $WOK/cacerts/receipt
57 src="$WOK/cacerts/source/cacerts-$VERSION"
58 mkdir -p $src
59 mv /tmp/certdata.txt $src
60 cd $src
62 # Save certdata in $SRC
63 TARBALL="$PACKAGE-$VERSION.txt"
64 [ -e "$SRC/$TARBALL" ] || cp $src/certdata.txt $SRC/$TARBALL
66 # Process...
67 cp -a $stuff/* $src
68 ./make-ca.sh &&
69 ./remove-expired-certs.sh $src/certs
71 # "Installing"
72 mkdir -p $install/etc/ssl/certs
73 cp -a $src/certs/*.pem $install/etc/ssl/certs
74 cp -a $src/ca-bundle.crt $install/etc/ssl
75 ln -s ../ca-bundle.crt $install/etc/ssl/certs/ca-certificates.crt
76 }
78 genpkg_rules() {
79 copy @std
80 DEPENDS="openssl"
81 }
83 # Rehash certificates.
84 # Use simplified plain shell equivalent to the Perl `c_rehash`
85 # (see openssl package). Normal no output here.
86 post_install() {
87 cd "$1/etc/ssl/certs"
88 find . -type l -delete
89 for i in $(ls *.pem); do
90 j="$(openssl x509 -hash -noout -in $i)"
91 [ -n "$j" ] && ln -s $i $j.0
92 done
93 }
95 # Remove broken symlinks
96 post_remove() {
97 find "$1/etc/ssl/certs" -type l ! -exec test -e '{}' \; -delete
98 }