source: common/func_compare.sh@ 9ddc6cf

experimental
Last change on this file since 9ddc6cf was 47fddc8, checked in by George Boudreau <georgeb@…>, 18 years ago

Change bool parameter definitions from 0/1 to y/n to match the new menu app

  • Property mode set to 100644
File size: 3.5 KB
Line 
1# $Id$
2
3#----------------------------------#
4wrt_compare_targets() { #
5#----------------------------------#
6
7 for ((N=1; N <= ITERATIONS ; N++)) ; do # Double parentheses,
8 # and "ITERATIONS" with no "$".
9 ITERATION=iteration-$N
10 if [ "$N" != "1" ] ; then
11 wrt_system_build "$N" "$PREV_IT"
12 fi
13 this_script=$ITERATION
14 wrt_target "$ITERATION" "$PREV"
15 wrt_compare_work "$ITERATION" "$PREV_IT"
16 wrt_logs "$N"
17 PREV_IT=$ITERATION
18 PREV=$ITERATION
19 done
20}
21
22#----------------------------------#
23wrt_system_build() { #
24#----------------------------------#
25 local RUN=$1
26 local PREV_IT=$2
27
28 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "chroot" ]] ; then
29 final_system_Makefiles $RUN
30 elif [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
31 bm_final_system_Makefiles $RUN
32 else
33 chapter6_Makefiles $RUN
34 fi
35
36 echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp
37}
38
39#----------------------------------#
40wrt_compare_work() { #
41#----------------------------------#
42 local ITERATION=$1
43 local PREV_IT=$2
44 local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
45/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
46
47 if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
48 local ROOT_DIR=/
49 local DEST_TOPDIR=/${SCRIPT_ROOT}
50 local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
51 local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
52 else
53 local ROOT_DIR=$BUILDDIR
54 local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT}
55 fi
56
57 if [[ "$RUN_ICA" = "y" ]] ; then
58 local DEST_ICA=$DEST_TOPDIR/ICA && \
59(
60 cat << EOF
61 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
62 extras/do_ica_prep $DEST_ICA/$ITERATION >>logs/$ITERATION.log 2>&1
63EOF
64) >> $MKFILE.tmp
65 if [[ "$ITERATION" != "iteration-1" ]] ; then
66 wrt_do_ica_work "$PREV_IT" "$ITERATION" "$DEST_ICA"
67 fi
68 fi
69
70 if [[ "$RUN_FARCE" = "y" ]] ; then
71 local DEST_FARCE=$DEST_TOPDIR/farce && \
72(
73 cat << EOF
74 @extras/do_copy_files "$PRUNEPATH" $ROOT_DIR $DEST_FARCE/$ITERATION >>logs/$ITERATION.log 2>&1 && \\
75 extras/filelist $DEST_FARCE/$ITERATION $DEST_FARCE/filelist-$ITERATION >>logs/$ITERATION.log 2>&1
76EOF
77) >> $MKFILE.tmp
78 if [[ "$ITERATION" != "iteration-1" ]] ; then
79 wrt_do_farce_work "$PREV_IT" "$ITERATION" "$DEST_FARCE"
80 fi
81 fi
82}
83
84#----------------------------------#
85wrt_do_ica_work() { #
86#----------------------------------#
87 echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
88}
89
90#----------------------------------#
91wrt_do_farce_work() { #
92#----------------------------------#
93 local OUTPUT=$FARCELOGDIR/${1}_V_${2}
94 local PREDIR=$3/$1
95 local PREFILE=$3/filelist-$1
96 local ITEDIR=$3/$2
97 local ITEFILE=$3/filelist-$2
98 echo -e "\t@extras/farce --directory $OUTPUT $PREDIR $PREFILE $ITEDIR $ITEFILE >>logs/$ITERATION.log 2>&1" >> $MKFILE.tmp
99}
100
101#----------------------------------#
102wrt_logs() { #
103#----------------------------------#
104 local ITERATION=iteration-$1
105
106(
107 cat << EOF
108 @pushd logs 1> /dev/null && \\
109 mkdir $ITERATION && \\
110 mv ${LOGS} $ITERATION && \\
111 popd 1> /dev/null
112 @touch \$@ && \\
113 sleep .25 && \\
114 echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
115 echo --------------------------------------------------------------------------------\$(WHITE)
116EOF
117) >> $MKFILE.tmp
118}
Note: See TracBrowser for help on using the repository browser.