home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
root
/
sbin
/
save_y2logs
< prev
next >
Wrap
Text File
|
2006-11-29
|
1KB
|
66 lines
#!/bin/bash
#
# save_y2logs - save YaST2 logs to a compressed tar file
# to attach it to a Bugzilla bug report
#
# Author: Stefan Hundhammer <sh@suse.de>
usage()
{
echo "Usage: $0 <tgz-file-name>"
echo ""
echo "Copies the YaST2 logs to a compressed tar archive."
exit 1
}
test -z "$1" && usage
case "$1" in
-*)
usage
;;
*.tgz|*.tar.gz)
TARGET="$1"
COMPRESSION=--gzip
;;
*.tar.bz2)
TARGET="$1"
COMPRESSION=--bzip2
if [ ! -x /usr/bin/bzip2 ]; then
echo "FATAL: /usr/bin/bzip2 not available" >&2
# This might easily happen in the inst-sys
exit 3
fi
;;
*)
echo "FATAL: Uncompressed archives not supported" >&2
echo "Use one of: .tgz .tar.gz .tar.bz2" >&2
exit 4
esac
LIST=YaST2
if [ -f /var/log/evms-engine.log ]; then
LIST="$LIST $( cd /var/log/; ls evms-engine.*)"
fi
RPM_LIST="rpm-qa"
rpm -qa --qf '%{NAME}-%{VERSION}-%{RELEASE}\t\t\t(%{VENDOR})\t%{DISTRIBUTION}\n' | sort >/var/log/$RPM_LIST
if [ -f /var/log/$RPM_LIST ]; then
LIST="$LIST $RPM_LIST"
fi
echo "Saving y2logs to $TARGET"
tar cf "$TARGET" $COMPRESSION --directory=/var/log $LIST && exit 0
echo "FATAL: Error creating archive $TARGET" >&2
exit 2