]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - release/scripts/package-trees.sh
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / release / scripts / package-trees.sh
1 #!/bin/sh
2 #
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.
7 #
8 # Usage: package-trees.sh <copy method> <INDEX> <package tree> <destination>
9 #
10 # $FreeBSD$
11
12 # Verify the command line
13 if [ $# -ne 4 ]; then
14     echo "Invalid number of arguments"
15     echo "Usage: package-trees.sh <copy method> <INDEX> <tree> <destination>"
16     exit 1
17 fi
18
19 COPY=$1 ; shift
20 INDEX=$1 ; shift
21 TREE=$1 ; shift
22 DESTDIR=$1 ; shift
23
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"
27
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
33 done
34
35 # Third, run through the INDEX copying each package to its appropriate CD and
36 # making the appropriate category symlinks
37 while read line; do
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"
44     fi
45     ${COPY} ${TREE}/All/${package}.tbz ${discdir}/packages/All
46     for cat in ${categories}; do
47         catdir=${discdir}/packages/${cat}
48         mkdir -p ${catdir}
49         ln -s ../All/${package}.tbz ${catdir}
50     done
51 done < ${INDEX}
52
53 # Fourth, output du info for the relative size of the trees.
54 discs=""
55 for disc in `jot $high_disc`; do
56     discs="${discs} disc${disc}"
57 done
58 (cd ${DESTDIR}; du -sh ${discs})