xref: /freebsd/release/scripts/make-manifest.sh (revision 4db78cacdee1b6f3b7880eb8c5560e8edaf91698)
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_ports=off
36default_tests=off
37default_base_dbg=off
38default_lib32_dbg=off
39default_kernel_alt=off
40default_kernel_dbg=on
41default_kernel_alt_dbg=off
42
43for i in ${*}; do
44	dist="${i}"
45	distname="${i%%.txz}"
46	distname="$(echo ${distname} | tr '-' '_')"
47	distname="$(echo ${distname} | tr 'kernel.' 'kernel_')"
48	hash="$(sha256 -q ${i})"
49	nfiles="$(tar tvf ${i} | wc -l | tr -d ' ')"
50	default="$(eval echo \${default_${distname}:-on})"
51	desc="$(eval echo \"\${desc_${distname}}\")"
52
53	case ${i} in
54		kernel-dbg.txz)
55			desc="${desc_kernel_dbg}"
56			;;
57		kernel.*-dbg.txz)
58			desc="$(eval echo \"${desc_kernel_alt_dbg}\")"
59			desc="${desc}: $(eval echo ${i%%-dbg.txz} | cut -f 2 -d '.')"
60			default="$(eval echo \"${default_kernel_alt_dbg}\")"
61			;;
62		kernel.*.txz)
63			desc="$(eval echo \"${desc_kernel_alt}\")"
64			desc="${desc}: $(eval echo ${i%%.txz} | cut -f 2 -d '.')"
65			default="$(eval echo \"${default_kernel_alt}\")"
66			;;
67		*)
68			;;
69	esac
70
71	printf "${dist}\t${hash}\t${nfiles}\t${distname}\t\"${desc}\"\t${default}\n"
72done
73
74