2006-03-09 04:38:59 +01:00
|
|
|
# $Id$
|
|
|
|
|
2006-04-08 16:02:59 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_ica_targets() { #
|
2006-04-08 18:30:12 +02:00
|
|
|
#----------------------------------#
|
2006-04-09 13:22:51 +02:00
|
|
|
local system_rebuild=$1
|
|
|
|
wrt_system_rebuild "$system_rebuild"
|
2006-04-09 17:16:49 +02:00
|
|
|
wrt_iterations "$system_rebuild"
|
2006-04-08 18:30:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
2006-04-09 13:22:51 +02:00
|
|
|
wrt_system_rebuild() { #
|
2006-04-08 16:02:59 +02:00
|
|
|
#----------------------------------#
|
2006-04-09 13:22:51 +02:00
|
|
|
local system_rebuild=$1
|
2006-04-08 16:02:59 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
2006-04-09 13:22:51 +02:00
|
|
|
system_rebuild: $system_rebuild
|
2006-04-08 16:02:59 +02:00
|
|
|
|
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
|
|
|
}
|
|
|
|
|
2006-04-08 18:30:12 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_iterations() { #
|
|
|
|
#----------------------------------#
|
2006-04-09 13:22:51 +02:00
|
|
|
local system_rebuild=$1
|
2006-04-08 18:30:12 +02:00
|
|
|
|
|
|
|
for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
|
|
|
|
# and "ITERATIONS" with no "$".
|
2006-04-09 17:07:36 +02:00
|
|
|
ITERATION=iteration-$N
|
|
|
|
if [ "$N" = "1" ] ; then
|
2006-04-10 19:21:46 +02:00
|
|
|
echo "$ITERATION: chapter6" >> $MKFILE
|
2006-04-09 17:07:36 +02:00
|
|
|
wrt_prepare "$ITERATION"
|
|
|
|
wrt_logs_and_clean "$ITERATION"
|
|
|
|
PREV=$ITERATION
|
|
|
|
elif [ "$N" = "$ITERATIONS" ] ; then
|
|
|
|
echo "iteration-last: $PREV system_rebuild" >> $MKFILE
|
2006-04-09 22:31:19 +02:00
|
|
|
wrt_prepare "$ITERATION" "$PREV"
|
2006-04-09 17:07:36 +02:00
|
|
|
wrt_logs "$ITERATION"
|
|
|
|
else
|
|
|
|
echo "$ITERATION: $PREV system_rebuild" >> $MKFILE
|
2006-04-09 22:31:19 +02:00
|
|
|
wrt_prepare "$ITERATION" "$PREV"
|
2006-04-09 17:07:36 +02:00
|
|
|
wrt_logs_and_clean "$ITERATION"
|
|
|
|
PREV=$ITERATION
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_prepare() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local ITERATION=$1
|
2006-04-09 22:31:19 +02:00
|
|
|
local PREV=$2
|
2006-04-09 17:07:36 +02:00
|
|
|
|
2006-04-09 17:16:49 +02:00
|
|
|
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
|
2006-04-09 17:07:36 +02:00
|
|
|
local PRUNEPATH="/jhalfs /sources /var/log/paco /opt /dev /home /mnt /proc \
|
|
|
|
/root /sys /tmp /usr/src /lost+found /tools"
|
2006-04-09 22:31:19 +02:00
|
|
|
local ROOT_DIR=/
|
2006-04-09 17:07:36 +02:00
|
|
|
local DEST_TOPDIR=/jhalfs
|
2006-04-09 22:31:19 +02:00
|
|
|
local ICALOGDIR=/jhalfs/logs/ICA
|
|
|
|
local FARCELOGDIR=/jhalfs/logs/farce
|
2006-04-09 17:07:36 +02:00
|
|
|
else
|
|
|
|
local PRUNEPATH="$BUILDDIR/jhalfs $BUILDDIR/sources $BUILDDIR/var/log/paco \
|
|
|
|
$BUILDDIR/opt $BUILDDIR/dev $BUILDDIR/home $BUILDDIR/mnt \
|
|
|
|
$BUILDDIR/proc $BUILDDIR/root $BUILDDIR/sys $BUILDDIR/tmp \
|
|
|
|
$BUILDDIR/usr/src $BUILDDIR/lost+found $BUILDDIR/tools"
|
2006-04-09 22:31:19 +02:00
|
|
|
local ROOT_DIR=$BUILDDIR
|
2006-04-09 17:07:36 +02:00
|
|
|
local DEST_TOPDIR=$BUILDDIR/jhalfs
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$RUN_ICA" = "1" ]] ; then
|
|
|
|
local DEST_ICA=$DEST_TOPDIR/ICA && \
|
2006-04-08 18:30:12 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
2006-04-10 19:26:20 +02:00
|
|
|
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION && \\
|
2006-04-09 17:07:36 +02:00
|
|
|
extras/do_ica_prep $DEST_ICA/$ITERATION
|
2006-04-08 18:30:12 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
2006-04-09 22:31:19 +02:00
|
|
|
if [[ "$ITERATION" != "iteration-1" ]] ; then
|
|
|
|
wrt_do_ica_work "$PREV" "$ITERATION" "$DEST_ICA"
|
|
|
|
fi
|
2006-04-09 17:07:36 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$RUN_FARCE" = "1" ]] ; then
|
|
|
|
local DEST_FARCE=$DEST_TOPDIR/farce && \
|
2006-04-08 18:30:12 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
2006-04-10 19:26:20 +02:00
|
|
|
@extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION && \\
|
2006-04-09 17:07:36 +02:00
|
|
|
extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/$ITERATION.filelist
|
2006-04-08 18:30:12 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
2006-04-09 22:31:19 +02:00
|
|
|
if [[ "$ITERATION" != "iteration-1" ]] ; then
|
|
|
|
wrt_do_farce_work "$PREV" "$ITERATION" "$DEST_FARCE"
|
|
|
|
fi
|
2006-04-09 17:07:36 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2006-04-09 22:31:19 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_do_ica_work() { #
|
|
|
|
#----------------------------------#
|
|
|
|
echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3" >> $MKFILE
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------------------------#
|
|
|
|
wrt_do_farce_work() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local OUTPUT=$FARCELOGDIR/${1}_V_${2}
|
|
|
|
local PREDIR=$3/$1
|
|
|
|
local PREFILE=$3/$1.filelist
|
|
|
|
local ITEDIR=$3/$2
|
|
|
|
local ITEFILE=$3/$2.filelist
|
|
|
|
echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE" >> $MKFILE
|
|
|
|
}
|
|
|
|
|
2006-04-09 17:07:36 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_logs_and_clean() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local ITERATION=$1
|
|
|
|
|
2006-04-08 18:30:12 +02:00
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@pushd logs && \\
|
|
|
|
mkdir $ITERATION && \\
|
2006-04-09 13:22:51 +02:00
|
|
|
mv $system_rebuild $ITERATION && \\
|
2006-04-08 18:30:12 +02:00
|
|
|
popd
|
2006-04-09 13:22:51 +02:00
|
|
|
@rm -f $system_rebuild
|
2006-04-09 22:31:19 +02:00
|
|
|
@touch \$@
|
|
|
|
|
2006-04-09 17:07:36 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
|
|
|
}
|
2006-04-08 18:30:12 +02:00
|
|
|
|
2006-04-09 17:07:36 +02:00
|
|
|
#----------------------------------#
|
|
|
|
wrt_logs() { #
|
|
|
|
#----------------------------------#
|
|
|
|
local ITERATION=$1
|
|
|
|
|
|
|
|
(
|
|
|
|
cat << EOF
|
|
|
|
@pushd logs && \\
|
|
|
|
mkdir $ITERATION && \\
|
|
|
|
cp $system_rebuild $ITERATION && \\
|
|
|
|
popd
|
2006-04-09 22:31:19 +02:00
|
|
|
@touch \$@
|
|
|
|
|
2006-04-08 18:30:12 +02:00
|
|
|
EOF
|
|
|
|
) >> $MKFILE
|
|
|
|
}
|