source: common/func_ICA.sh@ a101844

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

Typo fix.

  • Property mode set to 100644
File size: 3.2 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: chapter06" >> $MKFILE
33 wrt_prepare "$ITERATION"
34 wrt_logs_and_clean "$ITERATION"
35 echo -e "\t@touch \$@\n" >> $MKFILE
36 PREV=$ITERATION
37 elif [ "$N" = "$ITERATIONS" ] ; then
38 echo "iteration-last: $PREV system_rebuild" >> $MKFILE
39 wrt_prepare "$ITERATION"
40 wrt_logs "$ITERATION"
41 #I need to gigure out how to handle this for ITERATIONS > 2
42 # @do_ica_work $1 $2
43 # @farce $1 $2
44 echo -e "\t@touch \$@\n" >> $MKFILE
45 else
46 echo "$ITERATION: $PREV system_rebuild" >> $MKFILE
47 wrt_prepare "$ITERATION"
48 wrt_logs_and_clean "$ITERATION"
49 echo -e "\t@touch \$@\n" >> $MKFILE
50 PREV=$ITERATION
51 fi
52 done
53}
54
55#----------------------------------#
56wrt_prepare() { #
57#----------------------------------#
58 local ITERATION=$1
59
60 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
61 local PRUNEPATH="/jhalfs /sources /var/log/paco /opt /dev /home /mnt /proc \
62/root /sys /tmp /usr/src /lost+found /tools"
63 local ROOT_DIR=/
64 local DEST_TOPDIR=/jhalfs
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 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
90EOF
91) >> $MKFILE
92 fi
93}
94
95#----------------------------------#
96wrt_logs_and_clean() { #
97#----------------------------------#
98 local ITERATION=$1
99
100(
101 cat << EOF
102 @pushd logs && \\
103 mkdir $ITERATION && \\
104 mv $system_rebuild $ITERATION && \\
105 popd
106 @rm -f $system_rebuild
107EOF
108) >> $MKFILE
109}
110
111#----------------------------------#
112wrt_logs() { #
113#----------------------------------#
114 local ITERATION=$1
115
116(
117 cat << EOF
118 @pushd logs && \\
119 mkdir $ITERATION && \\
120 cp $system_rebuild $ITERATION && \\
121 popd
122EOF
123) >> $MKFILE
124}
Note: See TracBrowser for help on using the repository browser.