1 | # $Id: func_compare.sh 3824 2015-03-07 22:05:24Z pierre $
|
---|
2 |
|
---|
3 | #----------------------------------#
|
---|
4 | wrt_save_target() { #
|
---|
5 | #----------------------------------#
|
---|
6 |
|
---|
7 | local target
|
---|
8 | case $1 in
|
---|
9 | runasroot) target=SUDO ;;
|
---|
10 | chapter6 ) target=CHROOT ;;
|
---|
11 | esac
|
---|
12 | CHROOT_wrt_target save-ch5 "$PREV";
|
---|
13 | wrt_save_work $target
|
---|
14 | wrt_touch
|
---|
15 | PREV=save-ch5
|
---|
16 | eval $1=\"\$$1 save-ch5\"
|
---|
17 | }
|
---|
18 |
|
---|
19 | #----------------------------------#
|
---|
20 | wrt_save_work() { #
|
---|
21 | #----------------------------------#
|
---|
22 | local ROOT_DIR
|
---|
23 | case x"$1" in
|
---|
24 | xSUDO ) ROOT_DIR="$BUILDDIR/" ;;
|
---|
25 | xCHROOT) ROOT_DIR=/ ;;
|
---|
26 | esac
|
---|
27 |
|
---|
28 | local PRUNEPATH="./dev ./home ./lost+found ./media ./mnt ./opt ./proc ./root ./run ./srv ./sys ./tmp ./var"
|
---|
29 | local DEST_TOPDIR="${ROOT_DIR}${SCRIPT_ROOT}"
|
---|
30 |
|
---|
31 | (
|
---|
32 | cat << EOF
|
---|
33 | @mkdir -p /tmp >>logs/\$@ 2>&1 && \\
|
---|
34 | TARNAME=chapter5-\$\$(date -Iseconds).tar && \\
|
---|
35 | TMPFILE=\$\$(mktemp -p /tmp) && \\
|
---|
36 | TMPLOG=\$\$(mktemp -p /tmp) && \\
|
---|
37 | for F in $PRUNEPATH; do echo \$\$F >> \$\$TMPFILE; done && \\
|
---|
38 | tar -X \$\$TMPFILE -cvf /tmp/\$\$TARNAME -C ${ROOT_DIR} . >>\$\$TMPLOG 2>>logs/\$@ && \\
|
---|
39 | cat \$\$TMPLOG >>logs/\$@ 2>&1 && \\
|
---|
40 | mv /tmp/\$\$TARNAME $DEST_TOPDIR >>logs/\$@ 2>&1 && \\
|
---|
41 | rm \$\$TMPFILE \$\$TMPLOG
|
---|
42 | EOF
|
---|
43 | ) >> $MKFILE.tmp
|
---|
44 |
|
---|
45 | }
|
---|
46 |
|
---|
47 | #----------------------------------#
|
---|
48 | wrt_do_ica_work() { #
|
---|
49 | #----------------------------------#
|
---|
50 | echo -e "\t@extras/do_ica_work $1 $2 $ICALOGDIR $3 >>logs/\$@ 2>&1" >> $MKFILE.tmp
|
---|
51 | }
|
---|
52 |
|
---|
53 | #----------------------------------#
|
---|
54 | wrt_logs() { #
|
---|
55 | #----------------------------------#
|
---|
56 | local build=build_$1
|
---|
57 | local file
|
---|
58 |
|
---|
59 | (
|
---|
60 | cat << EOF
|
---|
61 | @cd logs && \\
|
---|
62 | mkdir $build && \\
|
---|
63 | mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
---|
64 | if [ ! $build = build_1 ] ; then \\
|
---|
65 | cd $build && \\
|
---|
66 | for file in \`ls .\` ; do \\
|
---|
67 | mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
---|
68 | done ; \\
|
---|
69 | fi
|
---|
70 | @cd /\$(SCRIPT_ROOT)
|
---|
71 | @if [ -d test-logs ] ; then \\
|
---|
72 | cd test-logs && \\
|
---|
73 | mkdir $build && \\
|
---|
74 | mv -f `echo ${system_build} | sed 's/ /* /g'`* $build && \\
|
---|
75 | if [ ! $build = build_1 ] ; then \\
|
---|
76 | cd $build && \\
|
---|
77 | for file in \`ls .\` ; do \\
|
---|
78 | mv -f \$\$file \`echo \$\$file | sed -e 's,-$build,,'\` ; \\
|
---|
79 | done ; \\
|
---|
80 | fi ; \\
|
---|
81 | cd /\$(SCRIPT_ROOT) ; \\
|
---|
82 | fi ;
|
---|
83 | EOF
|
---|
84 | ) >> $MKFILE.tmp
|
---|
85 | }
|
---|