source: common/func_ICA.sh@ 5112239

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

Revised PRUNEPATH list.

  • Property mode set to 100644
File size: 3.8 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 local PRUNEPATH="/dev /home /jhalfs /lost+found /media /mnt /opt /proc \
58/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
59
60 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
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 ROOT_DIR=$BUILDDIR
67 local DEST_TOPDIR=$BUILDDIR/jhalfs
68 fi
69
70 if [[ "$RUN_ICA" = "1" ]] ; then
71 local DEST_ICA=$DEST_TOPDIR/ICA && \
72(
73 cat << EOF
74 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION && \\
75 extras/do_ica_prep $DEST_ICA/$ITERATION
76EOF
77) >> $MKFILE
78 if [[ "$ITERATION" != "iteration-1" ]] ; then
79 wrt_do_ica_work "$PREV" "$ITERATION" "$DEST_ICA"
80 fi
81 fi
82
83 if [[ "$RUN_FARCE" = "1" ]] ; then
84 local DEST_FARCE=$DEST_TOPDIR/farce && \
85(
86 cat << EOF
87 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION && \\
88 extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
89EOF
90) >> $MKFILE
91 if [[ "$ITERATION" != "iteration-1" ]] ; then
92 wrt_do_farce_work "$PREV" "$ITERATION" "$DEST_FARCE"
93 fi
94 fi
95}
96
97#----------------------------------#
98wrt_do_ica_work() { #
99#----------------------------------#
100 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3" >> $MKFILE
101}
102
103#----------------------------------#
104wrt_do_farce_work() { #
105#----------------------------------#
106 local OUTPUT=$FARCELOGDIR/${1}_V_${2}
107 local PREDIR=$3/$1
108 local PREFILE=$3/$1.filelist
109 local ITEDIR=$3/$2
110 local ITEFILE=$3/$2.filelist
111 echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE" >> $MKFILE
112}
113
114#----------------------------------#
115wrt_logs_and_clean() { #
116#----------------------------------#
117 local ITERATION=$1
118
119(
120 cat << EOF
121 @pushd logs && \\
122 mkdir $ITERATION && \\
123 mv $system_rebuild $ITERATION && \\
124 popd
125 @rm -f $system_rebuild
126 @touch \$@
127
128EOF
129) >> $MKFILE
130}
131
132#----------------------------------#
133wrt_logs() { #
134#----------------------------------#
135 local ITERATION=$1
136
137(
138 cat << EOF
139 @pushd logs && \\
140 mkdir $ITERATION && \\
141 cp $system_rebuild $ITERATION && \\
142 popd
143 @touch \$@
144
145EOF
146) >> $MKFILE
147}
Note: See TracBrowser for help on using the repository browser.