3 # This script generates the disk layout for the CD images built by the FreeBSD
4 # release engineers as dictated by a specified master INDEX file. Each disc
5 # contains the master INDEX, it's assigned list of packages, and the
6 # appropriate tree of category symlinks.
8 # Usage: package-trees.sh <copy method> <INDEX> <package tree> <destination>
12 # Verify the command line
14 echo "Invalid number of arguments"
15 echo "Usage: package-trees.sh <copy method> <INDEX> <tree> <destination>"
24 # First, determine the highest disc number.
25 high_disc=`cut -d '|' -f 14 ${INDEX} | sort -n | tail -1`
26 echo "Generating trees for ${high_disc} discs"
28 # Second, initialize the trees for each disc
29 for disc in `jot $high_disc`; do
30 rm -rf ${DESTDIR}/disc${disc}/packages
31 mkdir -p ${DESTDIR}/disc${disc}/packages/All
32 cp ${INDEX} ${DESTDIR}/disc${disc}/packages/INDEX
35 # Third, run through the INDEX copying each package to its appropriate CD and
36 # making the appropriate category symlinks
38 disc=`echo $line | cut -d '|' -f 14`
39 package=`echo $line | cut -d '|' -f 1`
40 categories=`echo $line | cut -d '|' -f 7`
41 discdir=${DESTDIR}/disc${disc}
42 if [ -n "$PKG_VERBOSE" ]; then
43 echo "--> Copying $package to Disc $disc"
45 ${COPY} ${TREE}/All/${package}.tbz ${discdir}/packages/All
46 for cat in ${categories}; do
47 catdir=${discdir}/packages/${cat}
49 ln -s ../All/${package}.tbz ${catdir}
53 # Fourth, output du info for the relative size of the trees.
55 for disc in `jot $high_disc`; do
56 discs="${discs} disc${disc}"
58 (cd ${DESTDIR}; du -sh ${discs})