xref: /freebsd/release/scripts/make-manifest.sh (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
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
11base="Base system"
12kernel="Kernel"
13ports="Ports tree"
14src="System source tree"
15lib32="32-bit compatibility libraries"
16tests="Test suite"
17
18desc_base="${base} (MANDATORY)"
19desc_base_dbg="${base} (Debugging)"
20desc_kernel="${kernel} (MANDATORY)"
21desc_kernel_dbg="${kernel} (Debugging)"
22desc_kernel_alt="Alternate ${kernel}"
23desc_kernel_alt_dbg="Alternate ${kernel} (Debugging)"
24desc_lib32="${lib32}"
25desc_lib32_dbg="${lib32} (Debugging)"
26desc_ports="${ports}"
27desc_src="${src}"
28desc_tests="${tests}"
29
30default_src=off
31default_ports=off
32default_tests=off
33default_base_dbg=off
34default_lib32_dbg=off
35default_kernel_alt=off
36default_kernel_dbg=on
37default_kernel_alt_dbg=off
38
39for i in ${*}; do
40	dist="${i}"
41	distname="${i%%.txz}"
42	distname="$(echo ${distname} | tr '-' '_')"
43	distname="$(echo ${distname} | tr 'kernel.' 'kernel_')"
44	hash="$(sha256 -q ${i})"
45	nfiles="$(tar tvf ${i} | wc -l | tr -d ' ')"
46	default="$(eval echo \${default_${distname}:-on})"
47	desc="$(eval echo \"\${desc_${distname}}\")"
48
49	case ${i} in
50		doc.txz)
51			continue
52			;;
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