1 | # $Id$
|
---|
2 |
|
---|
3 | #----------------------------------#
|
---|
4 | wrt_ica_targets() { #
|
---|
5 | #----------------------------------#
|
---|
6 | local system_rebuild=$1
|
---|
7 | wrt_system_rebuild "$system_rebuild"
|
---|
8 | wrt_iterations "$system_rebuild"
|
---|
9 | }
|
---|
10 |
|
---|
11 | #----------------------------------#
|
---|
12 | wrt_system_rebuild() { #
|
---|
13 | #----------------------------------#
|
---|
14 | local system_rebuild=$1
|
---|
15 | (
|
---|
16 | cat << EOF
|
---|
17 | system_rebuild: $system_rebuild
|
---|
18 |
|
---|
19 | EOF
|
---|
20 | ) >> $MKFILE
|
---|
21 | }
|
---|
22 |
|
---|
23 | #----------------------------------#
|
---|
24 | wrt_iterations() { #
|
---|
25 | #----------------------------------#
|
---|
26 | local system_rebuild=$1
|
---|
27 |
|
---|
28 | for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
|
---|
29 | # and "ITERATIONS" with no "$".
|
---|
30 | ITERATION=iteration-$N
|
---|
31 | if [ "$N" = "1" ] ; then
|
---|
32 | echo "$ITERATION: chapter6" >> $MKFILE
|
---|
33 | wrt_prepare "$ITERATION"
|
---|
34 | wrt_logs_and_clean "$ITERATION"
|
---|
35 | PREV=$ITERATION
|
---|
36 | elif [ "$N" = "$ITERATIONS" ] ; then
|
---|
37 | echo "iteration-last: $PREV system_rebuild" >> $MKFILE
|
---|
38 | wrt_prepare "$ITERATION" "$PREV"
|
---|
39 | wrt_logs "$ITERATION"
|
---|
40 | else
|
---|
41 | echo "$ITERATION: $PREV system_rebuild" >> $MKFILE
|
---|
42 | wrt_prepare "$ITERATION" "$PREV"
|
---|
43 | wrt_logs_and_clean "$ITERATION"
|
---|
44 | PREV=$ITERATION
|
---|
45 | fi
|
---|
46 | done
|
---|
47 | }
|
---|
48 |
|
---|
49 | #----------------------------------#
|
---|
50 | wrt_prepare() { #
|
---|
51 | #----------------------------------#
|
---|
52 | local ITERATION=$1
|
---|
53 | local PREV=$2
|
---|
54 |
|
---|
55 | if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
---|
56 | local PRUNEPATH="/jhalfs /sources /var/log/paco /opt /dev /home /mnt /proc \
|
---|
57 | /root /sys /tmp /usr/src /lost+found /tools"
|
---|
58 | local ROOT_DIR=/
|
---|
59 | local DEST_TOPDIR=/jhalfs
|
---|
60 | local ICALOGDIR=/jhalfs/logs/ICA
|
---|
61 | local FARCELOGDIR=/jhalfs/logs/farce
|
---|
62 | else
|
---|
63 | local PRUNEPATH="$BUILDDIR/jhalfs $BUILDDIR/sources $BUILDDIR/var/log/paco \
|
---|
64 | $BUILDDIR/opt $BUILDDIR/dev $BUILDDIR/home $BUILDDIR/mnt \
|
---|
65 | $BUILDDIR/proc $BUILDDIR/root $BUILDDIR/sys $BUILDDIR/tmp \
|
---|
66 | $BUILDDIR/usr/src $BUILDDIR/lost+found $BUILDDIR/tools"
|
---|
67 | local ROOT_DIR=$BUILDDIR
|
---|
68 | local DEST_TOPDIR=$BUILDDIR/jhalfs
|
---|
69 | fi
|
---|
70 |
|
---|
71 | if [[ "$RUN_ICA" = "1" ]] ; then
|
---|
72 | local DEST_ICA=$DEST_TOPDIR/ICA && \
|
---|
73 | (
|
---|
74 | cat << EOF
|
---|
75 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION \\
|
---|
76 | extras/do_ica_prep $DEST_ICA/$ITERATION
|
---|
77 | EOF
|
---|
78 | ) >> $MKFILE
|
---|
79 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
80 | wrt_do_ica_work "$PREV" "$ITERATION" "$DEST_ICA"
|
---|
81 | fi
|
---|
82 | fi
|
---|
83 |
|
---|
84 | if [[ "$RUN_FARCE" = "1" ]] ; then
|
---|
85 | local DEST_FARCE=$DEST_TOPDIR/farce && \
|
---|
86 | (
|
---|
87 | cat << EOF
|
---|
88 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION \\
|
---|
89 | extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
|
---|
90 | EOF
|
---|
91 | ) >> $MKFILE
|
---|
92 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
93 | wrt_do_farce_work "$PREV" "$ITERATION" "$DEST_FARCE"
|
---|
94 | fi
|
---|
95 | fi
|
---|
96 | }
|
---|
97 |
|
---|
98 | #----------------------------------#
|
---|
99 | wrt_do_ica_work() { #
|
---|
100 | #----------------------------------#
|
---|
101 | echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3" >> $MKFILE
|
---|
102 | }
|
---|
103 |
|
---|
104 | #----------------------------------#
|
---|
105 | wrt_do_farce_work() { #
|
---|
106 | #----------------------------------#
|
---|
107 | local OUTPUT=$FARCELOGDIR/${1}_V_${2}
|
---|
108 | local PREDIR=$3/$1
|
---|
109 | local PREFILE=$3/$1.filelist
|
---|
110 | local ITEDIR=$3/$2
|
---|
111 | local ITEFILE=$3/$2.filelist
|
---|
112 | echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE" >> $MKFILE
|
---|
113 | }
|
---|
114 |
|
---|
115 | #----------------------------------#
|
---|
116 | wrt_logs_and_clean() { #
|
---|
117 | #----------------------------------#
|
---|
118 | local ITERATION=$1
|
---|
119 |
|
---|
120 | (
|
---|
121 | cat << EOF
|
---|
122 | @pushd logs && \\
|
---|
123 | mkdir $ITERATION && \\
|
---|
124 | mv $system_rebuild $ITERATION && \\
|
---|
125 | popd
|
---|
126 | @rm -f $system_rebuild
|
---|
127 | @touch \$@
|
---|
128 |
|
---|
129 | EOF
|
---|
130 | ) >> $MKFILE
|
---|
131 | }
|
---|
132 |
|
---|
133 | #----------------------------------#
|
---|
134 | wrt_logs() { #
|
---|
135 | #----------------------------------#
|
---|
136 | local ITERATION=$1
|
---|
137 |
|
---|
138 | (
|
---|
139 | cat << EOF
|
---|
140 | @pushd logs && \\
|
---|
141 | mkdir $ITERATION && \\
|
---|
142 | cp $system_rebuild $ITERATION && \\
|
---|
143 | popd
|
---|
144 | @touch \$@
|
---|
145 |
|
---|
146 | EOF
|
---|
147 | ) >> $MKFILE
|
---|
148 | }
|
---|