1 | # $Id$
|
---|
2 |
|
---|
3 | #----------------------------------#
|
---|
4 | wrt_compare_targets() { #
|
---|
5 | #----------------------------------#
|
---|
6 |
|
---|
7 | for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
|
---|
8 | # and "ITERATIONS" with no "$".
|
---|
9 | ITERATION=iteration-$N
|
---|
10 | if [ "$N" != "1" ] ; then
|
---|
11 | wrt_system_build "$N" "$PREV_IT"
|
---|
12 | fi
|
---|
13 | this_script=$ITERATION
|
---|
14 | CHROOT_wrt_target "$ITERATION" "$PREV"
|
---|
15 | wrt_compare_work "$ITERATION" "$PREV_IT"
|
---|
16 | wrt_logs "$N"
|
---|
17 | wrt_touch
|
---|
18 | PREV_IT=$ITERATION
|
---|
19 | PREV=$ITERATION
|
---|
20 | done
|
---|
21 | }
|
---|
22 |
|
---|
23 | #----------------------------------#
|
---|
24 | wrt_system_build() { #
|
---|
25 | #----------------------------------#
|
---|
26 | local RUN=$1
|
---|
27 | local PREV_IT=$2
|
---|
28 |
|
---|
29 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
30 | final_system_Makefiles $RUN
|
---|
31 | else
|
---|
32 | chapter6_Makefiles $RUN
|
---|
33 | fi
|
---|
34 |
|
---|
35 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
36 | basicsystem="$basicsystem $PREV_IT $system_build"
|
---|
37 | else
|
---|
38 | chapter6="$chapter6 $PREV_IT $system_build"
|
---|
39 | fi
|
---|
40 |
|
---|
41 | if [[ "$RUN" = "$ITERATIONS" ]] ; then
|
---|
42 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
43 | basicsystem="$basicsystem iteration-$RUN"
|
---|
44 | else
|
---|
45 | chapter6="$chapter6 iteration-$RUN"
|
---|
46 | fi
|
---|
47 | fi
|
---|
48 | }
|
---|
49 |
|
---|
50 | #----------------------------------#
|
---|
51 | wrt_compare_work() { #
|
---|
52 | #----------------------------------#
|
---|
53 | local ITERATION=$1
|
---|
54 | local PREV_IT=$2
|
---|
55 | local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
|
---|
56 | /sources /root /srv /sys /tmp /tools /usr/local /usr/src"
|
---|
57 |
|
---|
58 | local ROOT_DIR=/
|
---|
59 | local DEST_TOPDIR=/${SCRIPT_ROOT}
|
---|
60 | local ICALOGDIR=/${SCRIPT_ROOT}/${LOGDIRBASE}/ICA
|
---|
61 | local FARCELOGDIR=/${SCRIPT_ROOT}/${LOGDIRBASE}/farce
|
---|
62 |
|
---|
63 | if [[ "$RUN_ICA" = "y" ]] ; then
|
---|
64 | local DEST_ICA=$DEST_TOPDIR/ICA && \
|
---|
65 | (
|
---|
66 | cat << EOF
|
---|
67 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >> ${LOGDIRBASE}/\$@ 2>&1 && \\
|
---|
68 | extras/do_ica_prep $DEST_ICA/$ITERATION >> ${LOGDIRBASE}/\$@ 2>&1
|
---|
69 | EOF
|
---|
70 | ) >> $MKFILE.tmp
|
---|
71 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
72 | wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
|
---|
73 | fi
|
---|
74 | fi
|
---|
75 |
|
---|
76 | if [[ "$RUN_FARCE" = "y" ]] ; then
|
---|
77 | local DEST_FARCE=$DEST_TOPDIR/farce && \
|
---|
78 | (
|
---|
79 | cat << EOF
|
---|
80 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >> ${LOGDIRBASE}/\$@ 2>&1 && \\
|
---|
81 | extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >> ${LOGDIRBASE}/\$@ 2>&1
|
---|
82 | EOF
|
---|
83 | ) >> $MKFILE.tmp
|
---|
84 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
85 | wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
|
---|
86 | fi
|
---|
87 | fi
|
---|
88 | }
|
---|
89 |
|
---|
90 | #----------------------------------#
|
---|
91 | wrt_do_ica_work() { #
|
---|
92 | #----------------------------------#
|
---|
93 | echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >> ${LOGDIRBASE}/\$@ 2>&1" >> $MKFILE.tmp
|
---|
94 | }
|
---|
95 |
|
---|
96 | #----------------------------------#
|
---|
97 | wrt_do_farce_work() { #
|
---|
98 | #----------------------------------#
|
---|
99 | local OUTPUT=$FARCELOGDIR/${1}_V_${2}
|
---|
100 | local PREDIR=$3/$1
|
---|
101 | local PREFILE=$3/filelist-$1
|
---|
102 | local ITEDIR=$3/$2
|
---|
103 | local ITEFILE=$3/filelist-$2
|
---|
104 | echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >> ${LOGDIRBASE}/\$@ 2>&1" >> $MKFILE.tmp
|
---|
105 | }
|
---|
106 |
|
---|
107 | #----------------------------------#
|
---|
108 | wrt_logs() { #
|
---|
109 | #----------------------------------#
|
---|
110 | local build=build_$1
|
---|
111 | local file
|
---|
112 | local ch_order=${PREV%%_*}
|
---|
113 |
|
---|
114 | echo -e "\t@cd /\$(SCRIPT_ROOT)/${LOGDIRBASE} && mkdir $build && mv -f ${ch_order}_* $build" >> $MKFILE.tmp
|
---|
115 |
|
---|
116 | if [ ! "${1}" = "1" ] ; then
|
---|
117 | (
|
---|
118 | cat << EOF
|
---|
119 | @cd $build && \\
|
---|
120 | for file in \`ls .\` ; do \\
|
---|
121 | mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
---|
122 | done ;
|
---|
123 | EOF
|
---|
124 | ) >> $MKFILE.tmp
|
---|
125 | fi
|
---|
126 |
|
---|
127 | if [ ${CONFIG_TESTS} = "y" ] ; then
|
---|
128 | echo -e "\t@cd /\$(SCRIPT_ROOT)/${TESTLOGDIRBASE} && mkdir $build && mv -f ${ch_order}_* $build" >> $MKFILE.tmp
|
---|
129 | fi
|
---|
130 |
|
---|
131 | echo -e "\t@cd /\$(SCRIPT_ROOT)" >> $MKFILE.tmp
|
---|
132 | }
|
---|