summaryrefslogtreecommitdiff
path: root/create_ca-certificates-utils_shim.sh
blob: 01f75c509dc7ff766082d0c3a1bac69153192753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

# shellcheck source=./default.conf
. "./default.conf"

# the ca-certificates-utils-shim shim

if test ! -f $STAGE1_CHROOT/packages/$TARGET_CPU/ca-certificates-utils-shim-20170307-1-any.pkg.tar.xz; then

	cd $STAGE1_BUILD || exit 1
	sudo rm -rf ca-certificates-utils-shim
	
	mkdir ca-certificates-utils-shim
	cd ca-certificates-utils-shim || exit 1
	mkdir -p pkg/ca-certificates-utils-shim/etc/ssl/certs/
	cp /etc/ssl/certs/ca-certificates.crt pkg/ca-certificates-utils-shim/etc/ssl/certs/.

	BUILDDATE=$(date '+%s')
	size=$(du -sk --apparent-size pkg/)
	size="$(( ${size%%[^0-9]*} * 1024 ))"
	cat > pkg/ca-certificates-utils-shim/.PKGINFO <<EOF
pkgname = ca-certificates-utils
pkgver = 20170307-1
pkgdesc = Common CA certificates (utilities, from host machine)
url = http://pkgs.fedoraproject.org/cgit/rpms/ca-certificates.git
builddate = $BUILDDATE
size = $size
arch = any
EOF

	cd pkg/ca-certificates-utils-shim || exit 1
	# shellcheck disable=SC2035
	tar cJvf - .PKGINFO * | xz > ../../ca-certificates-utils-shim-20170307-1-any.pkg.tar.xz
	cd ../.. || exit 1

	cp -v ./*.pkg.tar.xz $STAGE1_CHROOT/packages/$TARGET_CPU/.
	rm -rf $STAGE1_CHROOT/var/cache/pacman/pkg/*
	rm -rf  $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db*
	rm -rf  $STAGE1_CHROOT/packages/$TARGET_CPU/temp.files*
	repo-add $STAGE1_CHROOT/packages/$TARGET_CPU/temp.db.tar.gz $STAGE1_CHROOT/packages/$TARGET_CPU/*pkg.tar.xz
	sudo pacman --force --noconfirm --config $STAGE1_CHROOT/etc/pacman.conf -r $STAGE1_CHROOT -Syy ca-certificates-utils

fi

echo "ca-certificate shim exists."