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
RevLine 
[1b9148c]1# $Id$
2
[a5fa1a9]3#----------------------------------#
4wrt_ica_targets() { #
[bfbd927]5#----------------------------------#
[fb68d23]6 local system_rebuild=$1
7 wrt_system_rebuild "$system_rebuild"
[aab6e73]8 wrt_iterations "$system_rebuild"
[bfbd927]9}
10
11#----------------------------------#
[fb68d23]12wrt_system_rebuild() { #
[a5fa1a9]13#----------------------------------#
[fb68d23]14 local system_rebuild=$1
[a5fa1a9]15(
16 cat << EOF
[fb68d23]17system_rebuild: $system_rebuild
[a5fa1a9]18
19EOF
20) >> $MKFILE
21}
22
[bfbd927]23#----------------------------------#
24wrt_iterations() { #
25#----------------------------------#
[fb68d23]26 local system_rebuild=$1
[bfbd927]27
28 for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
29 # and "ITERATIONS" with no "$".
[6794fe4]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
[aab6e73]60 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
[6794fe4]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 && \
[bfbd927]76(
77 cat << EOF
[6794fe4]78 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION \\
79 extras/do_ica_prep $DEST_ICA/$ITERATION
[bfbd927]80EOF
81) >> $MKFILE
[6794fe4]82 fi
83
84 if [[ "$RUN_FARCE" = "1" ]] ; then
85 local DEST_FARCE=$DEST_TOPDIR/farce && \
[bfbd927]86(
87 cat << EOF
[6794fe4]88 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION \\
89 extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
[bfbd927]90EOF
91) >> $MKFILE
[6794fe4]92 fi
93}
94
95#----------------------------------#
96wrt_logs_and_clean() { #
97#----------------------------------#
98 local ITERATION=$1
99
[bfbd927]100(
101 cat << EOF
102 @pushd logs && \\
103 mkdir $ITERATION && \\
[fb68d23]104 mv $system_rebuild $ITERATION && \\
[bfbd927]105 popd
[fb68d23]106 @rm -f $system_rebuild
[6794fe4]107EOF
108) >> $MKFILE
109}
[bfbd927]110
[6794fe4]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
[bfbd927]122EOF
123) >> $MKFILE
124}
Note: See TracBrowser for help on using the repository browser.