xref: /freebsd/release/scripts/make-manifest.sh (revision d9f0ce31900a48d1a2bfc1c8c86f79d1e831451a)
1#!/bin/sh
2
3# make-manifest.sh: create checksums and package descriptions for the installer
4#
5#  Usage: make-manifest.sh foo1.txz foo2.txz ...
6#
7# The output file looks like this (tab-delimited):
8#  foo1.txz SHA256-checksum Number-of-files foo1 Description Install-by-default
9#
10# $FreeBSD$
11
12base="Base system"
13doc="Additional Documentation"
14kernel="Kernel"
15ports="Ports tree"
16src="System source tree"
17lib32="32-bit compatibility libraries"
18tests="Test suite"
19
20desc_base="${base} (MANDATORY)"
21desc_base_dbg="${base} (Debugging)"
22desc_doc="${doc}"
23desc_kernel="${kernel} (MANDATORY)"
24desc_kernel_dbg="${kernel} (Debugging)"
25desc_kernel_alt="Alternate ${kernel}"
26desc_kernel_alt_dbg="Alternate ${kernel} (Debugging)"
27desc_lib32="${lib32}"
28desc_lib32_dbg="${lib32} (Debugging)"
29desc_ports="${ports}"
30desc_src="${src}"
31desc_tests="${tests}"
32
33default_doc=off
34default_src=off
35default_tests=off
36default_base_dbg=off
37default_lib32_dbg=off
38default_kernel_alt=off
39default_kernel_dbg=on
40default_kernel_alt_dbg=off
41
42for i in ${*}; do
43	dist="${i}"
44	distname="${i%%.txz}"
45	distname="$(echo ${distname} | tr '-' '_')"
46	distname="$(echo ${distname} | tr 'kernel.' 'kernel_')"
47	hash="$(sha256 -q ${i})"
48	nfiles="$(tar tvf ${i} | wc -l | tr -d ' ')"
49	default="$(eval echo \${default_${distname}:-on})"
50	desc="$(eval echo \"\${desc_${distname}}\")"
51
52	case ${i} in
53		kernel-dbg.txz)
54			desc="${desc_kernel_dbg}"
55			;;
56		kernel.*-dbg.txz)
57			desc="$(eval echo \"${desc_kernel_alt_dbg}\")"
58			desc="${desc}: $(eval echo ${i%%-dbg.txz} | cut -f 2 -d '.')"
59			default="$(eval echo \"${default_kernel_alt_dbg}\")"
60			;;
61		kernel.*.txz)
62			desc="$(eval echo \"${desc_kernel_alt}\")"
63			desc="${desc}: $(eval echo ${i%%.txz} | cut -f 2 -d '.')"
64			default="$(eval echo \"${default_kernel_alt}\")"
65			;;
66		*)
67			;;
68	esac
69
70	printf "${dist}\t${hash}\t${nfiles}\t${distname}\t\"${desc}\"\t${default}\n"
71done
72
73