[1b9148c] | 1 | # $Id$
|
---|
| 2 |
|
---|
[a5fa1a9] | 3 | #----------------------------------#
|
---|
| 4 | wrt_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] | 12 | wrt_system_rebuild() { #
|
---|
[a5fa1a9] | 13 | #----------------------------------#
|
---|
[fb68d23] | 14 | local system_rebuild=$1
|
---|
[a5fa1a9] | 15 | (
|
---|
| 16 | cat << EOF
|
---|
[fb68d23] | 17 | system_rebuild: $system_rebuild
|
---|
[a5fa1a9] | 18 |
|
---|
| 19 | EOF
|
---|
| 20 | ) >> $MKFILE
|
---|
| 21 | }
|
---|
| 22 |
|
---|
[bfbd927] | 23 | #----------------------------------#
|
---|
| 24 | wrt_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
|
---|
[6a14368] | 32 | echo "$ITERATION: chapter6" >> $MKFILE
|
---|
[13f1145] | 33 | echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
|
---|
[6794fe4] | 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
|
---|
[13f1145] | 39 | echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
|
---|
[8ba8df4] | 40 | wrt_prepare "$ITERATION" "$PREV"
|
---|
[6794fe4] | 41 | wrt_logs "$ITERATION"
|
---|
| 42 | else
|
---|
| 43 | echo "$ITERATION: $PREV system_rebuild" >> $MKFILE
|
---|
[13f1145] | 44 | echo -e "\t@\$(call echo_message, Building)" >> $MKFILE
|
---|
[8ba8df4] | 45 | wrt_prepare "$ITERATION" "$PREV"
|
---|
[6794fe4] | 46 | wrt_logs_and_clean "$ITERATION"
|
---|
| 47 | PREV=$ITERATION
|
---|
| 48 | fi
|
---|
| 49 | done
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | #----------------------------------#
|
---|
| 53 | wrt_prepare() { #
|
---|
| 54 | #----------------------------------#
|
---|
| 55 | local ITERATION=$1
|
---|
[8ba8df4] | 56 | local PREV=$2
|
---|
[5181eb3] | 57 | local PRUNEPATH="/jhalfs /sources /var/log/paco /opt /dev /home /mnt /proc \
|
---|
| 58 | /root /sys /tmp /usr/src /lost+found /tools"
|
---|
[6794fe4] | 59 |
|
---|
[aab6e73] | 60 | if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
---|
[8ba8df4] | 61 | local ROOT_DIR=/
|
---|
[6794fe4] | 62 | local DEST_TOPDIR=/jhalfs
|
---|
[8ba8df4] | 63 | local ICALOGDIR=/jhalfs/logs/ICA
|
---|
| 64 | local FARCELOGDIR=/jhalfs/logs/farce
|
---|
[6794fe4] | 65 | else
|
---|
[8ba8df4] | 66 | local ROOT_DIR=$BUILDDIR
|
---|
[6794fe4] | 67 | local DEST_TOPDIR=$BUILDDIR/jhalfs
|
---|
| 68 | fi
|
---|
| 69 |
|
---|
| 70 | if [[ "$RUN_ICA" = "1" ]] ; then
|
---|
| 71 | local DEST_ICA=$DEST_TOPDIR/ICA && \
|
---|
[bfbd927] | 72 | (
|
---|
| 73 | cat << EOF
|
---|
[685e4fc] | 74 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION && \\
|
---|
[6794fe4] | 75 | extras/do_ica_prep $DEST_ICA/$ITERATION
|
---|
[bfbd927] | 76 | EOF
|
---|
| 77 | ) >> $MKFILE
|
---|
[8ba8df4] | 78 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
| 79 | wrt_do_ica_work "$PREV" "$ITERATION" "$DEST_ICA"
|
---|
| 80 | fi
|
---|
[6794fe4] | 81 | fi
|
---|
| 82 |
|
---|
| 83 | if [[ "$RUN_FARCE" = "1" ]] ; then
|
---|
| 84 | local DEST_FARCE=$DEST_TOPDIR/farce && \
|
---|
[bfbd927] | 85 | (
|
---|
| 86 | cat << EOF
|
---|
[685e4fc] | 87 | @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION && \\
|
---|
[6794fe4] | 88 | extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
|
---|
[bfbd927] | 89 | EOF
|
---|
| 90 | ) >> $MKFILE
|
---|
[8ba8df4] | 91 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
| 92 | wrt_do_farce_work "$PREV" "$ITERATION" "$DEST_FARCE"
|
---|
| 93 | fi
|
---|
[6794fe4] | 94 | fi
|
---|
| 95 | }
|
---|
| 96 |
|
---|
[8ba8df4] | 97 | #----------------------------------#
|
---|
| 98 | wrt_do_ica_work() { #
|
---|
| 99 | #----------------------------------#
|
---|
| 100 | echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3" >> $MKFILE
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | #----------------------------------#
|
---|
| 104 | wrt_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 |
|
---|
[6794fe4] | 114 | #----------------------------------#
|
---|
| 115 | wrt_logs_and_clean() { #
|
---|
| 116 | #----------------------------------#
|
---|
| 117 | local ITERATION=$1
|
---|
| 118 |
|
---|
[bfbd927] | 119 | (
|
---|
| 120 | cat << EOF
|
---|
| 121 | @pushd logs && \\
|
---|
| 122 | mkdir $ITERATION && \\
|
---|
[fb68d23] | 123 | mv $system_rebuild $ITERATION && \\
|
---|
[bfbd927] | 124 | popd
|
---|
[fb68d23] | 125 | @rm -f $system_rebuild
|
---|
[8ba8df4] | 126 | @touch \$@
|
---|
| 127 |
|
---|
[6794fe4] | 128 | EOF
|
---|
| 129 | ) >> $MKFILE
|
---|
| 130 | }
|
---|
[bfbd927] | 131 |
|
---|
[6794fe4] | 132 | #----------------------------------#
|
---|
| 133 | wrt_logs() { #
|
---|
| 134 | #----------------------------------#
|
---|
| 135 | local ITERATION=$1
|
---|
| 136 |
|
---|
| 137 | (
|
---|
| 138 | cat << EOF
|
---|
| 139 | @pushd logs && \\
|
---|
| 140 | mkdir $ITERATION && \\
|
---|
| 141 | cp $system_rebuild $ITERATION && \\
|
---|
| 142 | popd
|
---|
[8ba8df4] | 143 | @touch \$@
|
---|
| 144 |
|
---|
[bfbd927] | 145 | EOF
|
---|
| 146 | ) >> $MKFILE
|
---|
| 147 | }
|
---|