source: common/func_ICA.sh@ 13f1145

experimental
Last change on this file since 13f1145 was 13f1145, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

Added Building messages.

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