source: common/func_ICA.sh@ 8ba8df4

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

Added wrt_do_X_work functions.

  • Property mode set to 100644
File size: 3.8 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 PREV=$ITERATION
36 elif [ "$N" = "$ITERATIONS" ] ; then
37 echo "iteration-last: $PREV system_rebuild" >> $MKFILE
[8ba8df4]38 wrt_prepare "$ITERATION" "$PREV"
[6794fe4]39 wrt_logs "$ITERATION"
40 else
41 echo "$ITERATION: $PREV system_rebuild" >> $MKFILE
[8ba8df4]42 wrt_prepare "$ITERATION" "$PREV"
[6794fe4]43 wrt_logs_and_clean "$ITERATION"
44 PREV=$ITERATION
45 fi
46 done
47}
48
49#----------------------------------#
50wrt_prepare() { #
51#----------------------------------#
52 local ITERATION=$1
[8ba8df4]53 local PREV=$2
[6794fe4]54
[aab6e73]55 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
[6794fe4]56 local PRUNEPATH="/jhalfs /sources /var/log/paco /opt /dev /home /mnt /proc \
57/root /sys /tmp /usr/src /lost+found /tools"
[8ba8df4]58 local ROOT_DIR=/
[6794fe4]59 local DEST_TOPDIR=/jhalfs
[8ba8df4]60 local ICALOGDIR=/jhalfs/logs/ICA
61 local FARCELOGDIR=/jhalfs/logs/farce
[6794fe4]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"
[8ba8df4]67 local ROOT_DIR=$BUILDDIR
[6794fe4]68 local DEST_TOPDIR=$BUILDDIR/jhalfs
69 fi
70
71 if [[ "$RUN_ICA" = "1" ]] ; then
72 local DEST_ICA=$DEST_TOPDIR/ICA && \
[bfbd927]73(
74 cat << EOF
[6794fe4]75 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION \\
76 extras/do_ica_prep $DEST_ICA/$ITERATION
[bfbd927]77EOF
78) >> $MKFILE
[8ba8df4]79 if [[ "$ITERATION" != "iteration-1" ]] ; then
80 wrt_do_ica_work "$PREV" "$ITERATION" "$DEST_ICA"
81 fi
[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
[8ba8df4]92 if [[ "$ITERATION" != "iteration-1" ]] ; then
93 wrt_do_farce_work "$PREV" "$ITERATION" "$DEST_FARCE"
94 fi
[6794fe4]95 fi
96}
97
[8ba8df4]98#----------------------------------#
99wrt_do_ica_work() { #
100#----------------------------------#
101 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3" >> $MKFILE
102}
103
104#----------------------------------#
105wrt_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
[6794fe4]115#----------------------------------#
116wrt_logs_and_clean() { #
117#----------------------------------#
118 local ITERATION=$1
119
[bfbd927]120(
121 cat << EOF
122 @pushd logs && \\
123 mkdir $ITERATION && \\
[fb68d23]124 mv $system_rebuild $ITERATION && \\
[bfbd927]125 popd
[fb68d23]126 @rm -f $system_rebuild
[8ba8df4]127 @touch \$@
128
[6794fe4]129EOF
130) >> $MKFILE
131}
[bfbd927]132
[6794fe4]133#----------------------------------#
134wrt_logs() { #
135#----------------------------------#
136 local ITERATION=$1
137
138(
139 cat << EOF
140 @pushd logs && \\
141 mkdir $ITERATION && \\
142 cp $system_rebuild $ITERATION && \\
143 popd
[8ba8df4]144 @touch \$@
145
[bfbd927]146EOF
147) >> $MKFILE
148}
Note: See TracBrowser for help on using the repository browser.