Dash:
[t2-trunk.git] / misc / archive / PackBuildInfo.sh
blob877a728e26c41384d8aa433138e5db8fe15c93d6
1 #!/bin/sh
2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 #
5 # T2 SDE: misc/archive/PackBuildInfo.sh
6 # Copyright (C) 2004 - 2005 The T2 SDE Project
7 #
8 # More information can be found in the files COPYING and README.
9 #
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
16 config=default
17 if [ "$1" == "-cfg" ]; then
18 config=$2; shift; shift
21 if [ ! -f config/$config/config ]; then
22 echo "ERROR: $config not found!"
23 exit 1
26 eval `grep "SDECFG_ID=" config/$config/config`
28 if [ -z "$SDECFG_ID" -o ! -d build/$SDECFG_ID/var/adm/logs/ ]; then
29 echo "ERROR: '$SDECFG' is not a valid build id!"
30 exit 2
33 tmpdir=`mktemp -d`
34 rev=`svn info | sed -n 's,^Revision: \(.*\),\1,p'`
35 mkdir -p $tmpdir/{config,cache,errlogs,flist} # logs
37 echo "INFO: backuping configuration of $config ..." 1>&2
38 cp -av config/$config/* $tmpdir/config/
40 echo "INFO: creating build summary ..." 1>&2
41 ./scripts/Create-ErrList -cfg $config 2>&1 | tee $tmpdir/summary
43 echo "INFO: adding cache files ..." 1>&2
44 #for x in $( cd build/$SDECFG_ID/var/adm/cache; ls -1 ); do
45 # [ -s build/$SDECFG_ID/var/adm/cache/$x ] && \
46 # cp build/$SDECFG_ID/var/adm/cache/$x $tmpdir/cache/
47 cp build/$SDECFG_ID/var/adm/cache/* $tmpdir/cache/
48 #done
50 echo "INFO: adding log files ..." 1>&2
51 #for x in $( cd build/$SDECFG_ID/var/adm/logs; ls -1 ); do
52 # if [ -s build/$SDECFG_ID/var/adm/logs/$x ]; then
53 # [[ $x == *.out ]] && continue
54 # cp build/$SDECFG_ID/var/adm/logs/$x $tmpdir/logs/
55 cp build/$SDECFG_ID/var/adm/logs/*.err $tmpdir/errlogs/
56 # [[ $x == *.err ]] && ln -s ../logs/$x $tmpdir/errlogs/$x
57 # fi
58 #done
60 echo "INFO: adding flist files ..." 1>&2
61 #for x in $( cd build/$SDECFG_ID/var/adm/flists; ls -1 ); do
62 # [ -s $x ] && cp build/$SDECFG_ID/var/adm/flists/$x $tmpdir/flist/
63 cp build/$SDECFG_ID/var/adm/flists/* $tmpdir/flist/
64 #done
66 tar -C $tmpdir -jcf cachepack-$config-t2-r${rev:-0}.tar.bz2 .
68 rm -rf $tmpdir