busybox: add script to collect and compress some usefull logfiles

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-01-17 18:18:41 +01:00
parent 3002a51a4b
commit 35267ea3c3
2 changed files with 94 additions and 0 deletions

View File

@ -38,6 +38,9 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw $USER_PASSWORD`"
mkdir -p $INSTALL/bin
cp $PKG_DIR/scripts/lsb-release $INSTALL/bin/
mkdir -p $INSTALL/usr/bin
cp $PKG_DIR/scripts/createlog $INSTALL/usr/bin/
mkdir -p $INSTALL/sbin
cp $PKG_DIR/scripts/init $INSTALL/sbin/

View File

@ -0,0 +1,91 @@
#!/bin/sh
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# create logfile
DATE=`date -u +%Y-%m-%d-%H.%M.%S`
BASEDIR="/tmp"
LOGDIR="log-$DATE"
getlog_cmd() {
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
echo "# ... output of $@" >> $BASEDIR/$LOGDIR/$LOGFILE
echo "################################################################################" >> $BASEDIR/$LOGDIR/$LOGFILE
$@ >> $BASEDIR/$LOGDIR/$LOGFILE
echo "" >> $BASEDIR/$LOGDIR/$LOGFILE
}
rm -rf $BASEDIR/$LOGDIR
mkdir -p $BASEDIR/$LOGDIR
# OS Info
LOGFILE="00_OS.log"
getlog_cmd cat /etc/issue
# XBMC.log
LOGFILE="01_XBMC.log"
for i in `find /storage/.xbmc/temp/ -type f -name "*.log"`; do
getlog_cmd cat $i
done
# Kernel.log
LOGFILE="02_Kernel.log"
getlog_cmd lsmod
getlog_cmd dmesg
# Hardware.log
LOGFILE="03_Hardware.log"
getlog_cmd lspci -vvv
getlog_cmd lsusb -vvv
getlog_cmd cat /proc/cpuinfo
# Audio.log
LOGFILE="04_Audio.log"
getlog_cmd aplay -l
getlog_cmd aplay -L
getlog_cmd amixer
# Network.log
LOGFILE="05_Network.log"
getlog_cmd ifconfig
# varlog.log
LOGFILE="06_varlog.log"
for i in `find /var/log -type f`; do
getlog_cmd cat $i
done
# Input.log
LOGFILE="07_input.log"
getlog_cmd cat /proc/bus/input/devices
getlog_cmd cat /proc/acpi/wakeup
# DMI.log
LOGFILE="08_dmi.log"
getlog_cmd dmidecode
# pack logfiles
mkdir -p /storage/.config/logfiles
tar cvjf /storage/.config/logfiles/log-$DATE.tar.bz2 $LOGDIR -C $BASEDIR
# remove logdir
rm -rf $BASEDIR/$LOGDIR