2006-04-29 16:44:29 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_compare_targets() { #
|
|
|
|
#----------------------------------#
|
|
|
|
|
|
|
|
for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
|
|
|
|
# and "ITERATIONS" with no "$".
|
|
|
|
ITERATION=iteration-$N
|
|
|
|
if [ "$N" != "1" ] ; then
|
2020-06-14 09:08:19 +02:00
|
|
|
wrt_system_build "$1" "$N" "$PREV_IT"
|
2006-04-29 16:44:29 +02:00
|
|
|
fi
|
2020-06-14 09:08:19 +02:00
|
|
|
# add needed Makefile target
|
2006-04-29 16:44:29 +02:00
|
|
|
this_script=$ITERATION
|
2006-10-02 21:32:06 +02:00
|
|
|
CHROOT_wrt_target "$ITERATION" "$PREV"
|
2006-04-29 16:44:29 +02:00
|
|
|
wrt_compare_work "$ITERATION" "$PREV_IT"
|
2006-12-05 16:25:00 +01:00
|
|
|
wrt_logs "$N"
|
2006-12-04 21:58:09 +01:00
|
|
|
wrt_touch
|
2006-04-29 16:44:29 +02:00
|
|
|
PREV_IT=$ITERATION
|
|
|
|
PREV=$ITERATION
|
|
|
|
done
|
2020-06-14 09:08:19 +02:00
|
|
|
# We need to prevent "userdel" in all iterations but the last
|
|
|
|
# We need to access the scriptlets in "dir"
|
|
|
|
local dir
|
|
|
|
printf -v dir chapter%02d "$1"
|
|
|
|
|
|
|
|
sed -i '/userdel/d' $dir/*revised*
|
|
|
|
for (( N = 2; N < ITERATIONS; N++ )); do
|
|
|
|
sed -i '/userdel/d' $dir-build_$N/*revised*
|
|
|
|
done
|
|
|
|
|
2006-04-29 16:44:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_system_build() { #
|
|
|
|
#----------------------------------#
|
2020-06-14 09:08:19 +02:00
|
|
|
local CHAP=$1
|
|
|
|
local RUN=$2
|
|
|
|
local PREV_IT=$3
|
2006-04-29 16:44:29 +02:00
|
|
|
|
2022-03-01 21:09:30 +01:00
|
|
|
chapter_targets $CHAP $RUN
|
2006-04-29 16:44:29 +02:00
|
|
|
|
2022-03-01 21:09:30 +01:00
|
|
|
CHROOT_TGT="$CHROOT_TGT $PREV_IT $system_build"
|
2006-10-02 21:32:06 +02:00
|
|
|
|
|
|
|
if [[ "$RUN" = "$ITERATIONS" ]] ; then
|
2020-06-14 09:08:19 +02:00
|
|
|
CHROOT_TGT="$CHROOT_TGT iteration-$RUN"
|
2006-10-02 21:32:06 +02:00
|
|
|
fi
|
2006-04-29 16:44:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_compare_work() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local ITERATION=$1
|
|
|
|
local PREV_IT=$2
|
2006-06-01 22:49:41 +02:00
|
|
|
local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
|
2020-05-01 16:24:32 +02:00
|
|
|
/sources /root /run /srv /sys /tmp /tools /usr/local /usr/src /var"
|
2006-04-29 16:44:29 +02:00
|
|
|
|
2006-10-02 21:32:06 +02:00
|
|
|
local ROOT_DIR=/
|
|
|
|
local DEST_TOPDIR=/${SCRIPT_ROOT}
|
|
|
|
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
|
2006-04-29 16:44:29 +02:00
|
|
|
|
2006-08-16 19:42:54 +02:00
|
|
|
if [[ "$RUN_ICA" = "y" ]] ; then
|
2006-04-29 16:44:29 +02:00
|
|
|
local DEST_ICA=$DEST_TOPDIR/ICA && \
|
2020-04-10 12:16:41 +02:00
|
|
|
# the PRUNEPATH additional setting is to avoid .pyc files to show up in diff
|
2006-04-29 16:44:29 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
2020-04-10 12:16:41 +02:00
|
|
|
@PRUNEPATH="$PRUNEPATH \$\$(find /usr/lib -name __pycache__)"; \\
|
|
|
|
extras/do_copy_files "\$\$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/\$@ 2>&1 && \\
|
2006-12-04 21:58:09 +01:00
|
|
|
extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/\$@ 2>&1
|
2006-04-29 16:44:29 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
if [[ "$ITERATION" != "iteration-1" ]] ; then
|
|
|
|
wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_do_ica_work() { #
|
|
|
|
#----------------------------------#
|
2006-12-04 21:58:09 +01:00
|
|
|
echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
|
2006-04-29 16:44:29 +02:00
|
|
|
}
|
|
|
|
|
2006-12-05 16:25:00 +01:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_logs() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local build=build_$1
|
|
|
|
local file
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@cd logs && \\
|
|
|
|
mkdir $build && \\
|
2015-03-07 23:05:24 +01:00
|
|
|
mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
2006-12-05 16:25:00 +01:00
|
|
|
if [ ! $build = build_1 ] ; then \\
|
|
|
|
cd $build && \\
|
|
|
|
for file in \`ls .\` ; do \\
|
|
|
|
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
|
|
|
done ; \\
|
2020-04-02 11:56:51 +02:00
|
|
|
fi
|
2006-12-05 16:25:00 +01:00
|
|
|
@cd /\$(SCRIPT_ROOT)
|
|
|
|
@if [ -d test-logs ] ; then \\
|
|
|
|
cd test-logs && \\
|
|
|
|
mkdir $build && \\
|
2019-04-24 17:07:04 +02:00
|
|
|
mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
2006-12-05 16:25:00 +01:00
|
|
|
if [ ! $build = build_1 ] ; then \\
|
|
|
|
cd $build && \\
|
|
|
|
for file in \`ls .\` ; do \\
|
|
|
|
mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
|
|
|
done ; \\
|
|
|
|
fi ; \\
|
|
|
|
cd /\$(SCRIPT_ROOT) ; \\
|
|
|
|
fi ;
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE.tmp
|
|
|
|
}
|