source: common/libs/func_save.sh@ 9a09336

trunk
Last change on this file since 9a09336 was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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