1 | #!/bin/bash |
---|
2 | |
---|
3 | # Slackware build script for ca-certificates |
---|
4 | |
---|
5 | # Copyright 2009,2011 Robby Workman Northport, AL, USA |
---|
6 | # Copyright 2012, 2013, 2015, 2016, 2018 Patrick J. Volkerding, Sebeka, MN, USA |
---|
7 | # All rights reserved. |
---|
8 | # |
---|
9 | # Redistribution and use of this script, with or without modification, is |
---|
10 | # permitted provided that the following conditions are met: |
---|
11 | # |
---|
12 | # 1. Redistributions of this script must retain the above copyright |
---|
13 | # notice, this list of conditions and the following disclaimer. |
---|
14 | # |
---|
15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
16 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
17 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
18 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
19 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
20 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
21 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
22 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
23 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
24 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
25 | |
---|
26 | cd $(dirname $0) ; CWD=$(pwd) |
---|
27 | |
---|
28 | PKGNAM=ca-certificates |
---|
29 | VERSION=${VERSION:-$(echo certdata-*.txt.xz | cut -f 2 -d - | cut -f 1 -d .)} |
---|
30 | ARCH=noarch |
---|
31 | BUILD=${BUILD:-1_slack14.2} |
---|
32 | |
---|
33 | # If the variable PRINT_PACKAGE_NAME is set, then this script will report what |
---|
34 | # the name of the created package would be, and then exit. This information |
---|
35 | # could be useful to other scripts. |
---|
36 | if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then |
---|
37 | echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz" |
---|
38 | exit 0 |
---|
39 | fi |
---|
40 | |
---|
41 | TARVERSION=${VERSION} |
---|
42 | |
---|
43 | TMP=${TMP:-/tmp} |
---|
44 | PKG=$TMP/package-$PKGNAM |
---|
45 | |
---|
46 | rm -rf $PKG |
---|
47 | mkdir -p $TMP $PKG/usr/share/ca-certificates $PKG/usr/sbin |
---|
48 | cd $TMP |
---|
49 | |
---|
50 | rm -rf $PKGNAM |
---|
51 | |
---|
52 | # Extract the tarball: |
---|
53 | tar xvf $CWD/${PKGNAM}.tar.?z || exit 1 |
---|
54 | |
---|
55 | cd $PKGNAM || exit 1 |
---|
56 | |
---|
57 | chown -R root:root . |
---|
58 | find . \ |
---|
59 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
60 | -exec chmod 755 {} \; -o \ |
---|
61 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
62 | -exec chmod 644 {} \; |
---|
63 | |
---|
64 | # Remove incompatible command operators used to call 'run-parts': |
---|
65 | zcat $CWD/fixup_update-ca-certificates.diff.gz | patch -p1 || exit 1 |
---|
66 | |
---|
67 | # Use "c_rehash" rather than "openssl rehash". They act mostly the same, but |
---|
68 | # the openssl builtin is not available on older versions of Slackware, while |
---|
69 | # c_rehash will always be there. |
---|
70 | zcat $CWD/update-ca-certificates.c_rehash.diff.gz | patch -p1 || exit 1 |
---|
71 | |
---|
72 | # Update to certdata.txt from $CWD: |
---|
73 | xzcat $CWD/certdata-${VERSION}.txt.xz > mozilla/certdata.txt |
---|
74 | |
---|
75 | make || exit 1 |
---|
76 | make install DESTDIR=$PKG || exit 1 |
---|
77 | |
---|
78 | # Remove expired certificate: |
---|
79 | if [ -r $PKG//usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt ]; then |
---|
80 | rm -f $PKG//usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt |
---|
81 | fi |
---|
82 | |
---|
83 | mkdir -p $PKG/etc/ca-certificates/update.d |
---|
84 | printf "# Automatically generated by $PKGNAM-$VERSION \n#\n" \ |
---|
85 | > $PKG/etc/ca-certificates.conf |
---|
86 | ( cd $PKG/usr/share/ca-certificates |
---|
87 | find . -name '*.crt' | sort | cut -b3- |
---|
88 | ) >> $PKG/etc/ca-certificates.conf |
---|
89 | |
---|
90 | mkdir -p $PKG/usr/man/man8 |
---|
91 | gzip -9c sbin/update-ca-certificates.8 > \ |
---|
92 | $PKG/usr/man/man8/update-ca-certificates.8.gz |
---|
93 | |
---|
94 | mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION |
---|
95 | cp -a docs/* $PKG/usr/doc/$PKGNAM-$VERSION |
---|
96 | |
---|
97 | mkdir -p $PKG/var/log/setup |
---|
98 | cat $CWD/setup.11.cacerts > $PKG/var/log/setup/setup.11.cacerts |
---|
99 | chmod 755 $PKG/var/log/setup/setup.11.cacerts |
---|
100 | |
---|
101 | mkdir -p $PKG/install |
---|
102 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
103 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
104 | |
---|
105 | cd $PKG |
---|
106 | /sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz |
---|