[45f82718] | 1 | #----------------------------------#
|
---|
| 2 | wrt_compare_targets() { #
|
---|
| 3 | #----------------------------------#
|
---|
| 4 |
|
---|
| 5 | for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
|
---|
| 6 | # and "ITERATIONS" with no "$".
|
---|
| 7 | ITERATION=iteration-$N
|
---|
| 8 | if [ "$N" != "1" ] ; then
|
---|
[3da8c49] | 9 | wrt_system_build "$1" "$N" "$PREV_IT"
|
---|
[45f82718] | 10 | fi
|
---|
[3da8c49] | 11 | # add needed Makefile target
|
---|
[45f82718] | 12 | this_script=$ITERATION
|
---|
[045b2dc] | 13 | CHROOT_wrt_target "$ITERATION" "$PREV"
|
---|
[45f82718] | 14 | wrt_compare_work "$ITERATION" "$PREV_IT"
|
---|
[10c8b78] | 15 | wrt_logs "$N"
|
---|
[6bb080e] | 16 | wrt_touch
|
---|
[45f82718] | 17 | PREV_IT=$ITERATION
|
---|
| 18 | PREV=$ITERATION
|
---|
| 19 | done
|
---|
[3da8c49] | 20 | # We need to prevent "userdel" in all iterations but the last
|
---|
| 21 | # We need to access the scriptlets in "dir"
|
---|
| 22 | local dir
|
---|
| 23 | printf -v dir chapter%02d "$1"
|
---|
| 24 |
|
---|
| 25 | sed -i '/userdel/d' $dir/*revised*
|
---|
| 26 | for (( N = 2; N < ITERATIONS; N++ )); do
|
---|
| 27 | sed -i '/userdel/d' $dir-build_$N/*revised*
|
---|
| 28 | done
|
---|
| 29 |
|
---|
[45f82718] | 30 | }
|
---|
| 31 |
|
---|
| 32 | #----------------------------------#
|
---|
| 33 | wrt_system_build() { #
|
---|
| 34 | #----------------------------------#
|
---|
[3da8c49] | 35 | local CHAP=$1
|
---|
| 36 | local RUN=$2
|
---|
| 37 | local PREV_IT=$3
|
---|
[45f82718] | 38 |
|
---|
[7a84ba7] | 39 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
| 40 | final_system_Makefiles $RUN
|
---|
[45f82718] | 41 | else
|
---|
[3da8c49] | 42 | chapter_targets $CHAP $RUN
|
---|
[45f82718] | 43 | fi
|
---|
| 44 |
|
---|
[045b2dc] | 45 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
| 46 | basicsystem="$basicsystem $PREV_IT $system_build"
|
---|
| 47 | else
|
---|
[3da8c49] | 48 | CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
|
---|
[045b2dc] | 49 | fi
|
---|
| 50 |
|
---|
| 51 | if [[ "$RUN" = "$ITERATIONS" ]] ; then
|
---|
| 52 | if [[ "$PROGNAME" = "clfs" ]] ; then
|
---|
| 53 | basicsystem="$basicsystem iteration-$RUN"
|
---|
| 54 | else
|
---|
[3da8c49] | 55 | CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
|
---|
[045b2dc] | 56 | fi
|
---|
| 57 | fi
|
---|
[45f82718] | 58 | }
|
---|
| 59 |
|
---|
| 60 | #----------------------------------#
|
---|
| 61 | wrt_compare_work() { #
|
---|
| 62 | #----------------------------------#
|
---|
| 63 | local ITERATION=$1
|
---|
| 64 | local PREV_IT=$2
|
---|
[1a1f099] | 65 | local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
|
---|
[f5ecc28] | 66 | /sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
|
---|
[45f82718] | 67 |
|
---|
[045b2dc] | 68 | local ROOT_DIR=/
|
---|
| 69 | local DEST_TOPDIR=/${SCRIPT_ROOT}
|
---|
| 70 | local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
|
---|
[45f82718] | 71 |
|
---|
[401f81e] | 72 | if [[ "$RUN_ICA" = "y" ]] ; then
|
---|
[45f82718] | 73 | local DEST_ICA=$DEST_TOPDIR/ICA && \
|
---|
[31a9b14] | 74 | # the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
|
---|
[45f82718] | 75 | (
|
---|
| 76 | cat << EOF
|
---|
[31a9b14] | 77 | @PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
|
---|
| 78 | extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
|
---|
[6bb080e] | 79 | extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
|
---|
[45f82718] | 80 | EOF
|
---|
| 81 | ) >> $MKFILE.tmp
|
---|
| 82 | if [[ "$ITERATION" != "iteration-1" ]] ; then
|
---|
| 83 | wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
|
---|
| 84 | fi
|
---|
| 85 | fi
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | #----------------------------------#
|
---|
| 89 | wrt_do_ica_work() { #
|
---|
| 90 | #----------------------------------#
|
---|
[6bb080e] | 91 | echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
|
---|
[45f82718] | 92 | }
|
---|
| 93 |
|
---|
[10c8b78] | 94 | #----------------------------------#
|
---|
| 95 | wrt_logs() { #
|
---|
| 96 | #----------------------------------#
|
---|
| 97 | local build=build_$1
|
---|
| 98 | local file
|
---|
| 99 |
|
---|
| 100 | (
|
---|
| 101 | cat << EOF
|
---|
| 102 | @cd logs && \\
|
---|
| 103 | mkdir $build && \\
|
---|
[b7515ec] | 104 | mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
---|
[10c8b78] | 105 | if [ ! $build = build_1 ] ; then \\
|
---|
| 106 | cd $build && \\
|
---|
| 107 | for file in \`ls .\` ; do \\
|
---|
| 108 | mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
---|
| 109 | done ; \\
|
---|
[7b7b5e9] | 110 | fi
|
---|
[10c8b78] | 111 | @cd /\$(SCRIPT_ROOT)
|
---|
| 112 | @if [ -d test-logs ] ; then \\
|
---|
| 113 | cd test-logs && \\
|
---|
| 114 | mkdir $build && \\
|
---|
[7fa9369] | 115 | mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
---|
[10c8b78] | 116 | if [ ! $build = build_1 ] ; then \\
|
---|
| 117 | cd $build && \\
|
---|
| 118 | for file in \`ls .\` ; do \\
|
---|
| 119 | mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
---|
| 120 | done ; \\
|
---|
| 121 | fi ; \\
|
---|
| 122 | cd /\$(SCRIPT_ROOT) ; \\
|
---|
| 123 | fi ;
|
---|
| 124 | EOF
|
---|
| 125 | ) >> $MKFILE.tmp
|
---|
| 126 | }
|
---|