wok-next annotate cacerts/receipt @ rev 20221

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