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