xref: /freebsd/release/tools/oci-image-static.conf (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1#! /bin/sh
2
3# Build Open Container Initiative (OCI) container image suitable as a base for
4# static-linked workloads. This contains mtree directories, SSL certificates and
5# a few other config files.
6
7OCI_BASE_IMAGE=
8
9oci_image_build() {
10	mtree -deU -p $m/ -f /etc/mtree/BSD.root.dist > /dev/null
11	mtree -deU -p $m/var -f /etc/mtree/BSD.var.dist > /dev/null
12	mtree -deU -p $m/usr -f /etc/mtree/BSD.usr.dist > /dev/null
13	mtree -deU -p $m/usr/include -f /etc/mtree/BSD.include.dist > /dev/null
14	mtree -deU -p $m/usr/lib -f /etc/mtree/BSD.debug.dist > /dev/null
15	install_packages ${abi} ${workdir} $m FreeBSD-caroot FreeBSD-zoneinfo
16	cp /etc/master.passwd $m/etc
17	pwd_mkdb -p -d $m/etc $m/etc/master.passwd || return $?
18	cp /etc/group $m/etc || return $?
19	cp /etc/termcap.small $m/etc/termcap.small || return $?
20	cp /etc/termcap.small $m/usr/share/misc/termcap || return $?
21	env DESTDIR=$m /usr/sbin/certctl rehash
22	# Generate a suitable repo config for pkgbase
23	case ${branch} in
24		CURRENT|STABLE|BETA*)
25			repo=base_latest
26			;;
27		*)
28			repo=base_release_${minor}
29			;;
30	esac
31	mkdir -p $m/usr/local/etc/pkg/repos
32	cat > $m/usr/local/etc/pkg/repos/base.conf <<EOF
33FreeBSD-base: {
34  url: "https://pkg.FreeBSD.org/\${ABI}/${repo}",
35  mirror_type: "srv",
36  signature_type: "fingerprints",
37  fingerprints: "/usr/share/keys/pkg",
38  enabled: yes
39}
40EOF
41
42}
43