#! /bin/sh
#----------------------------------------------------------------------------------
# /var/install/bin/capi2text-pre-view-log - extract log information
#
# Copyright (c) 2008-2024  The Eisfair Team, team(at)eisfair(dot)org
#
# Creation   : 2015-05-31 jed
# Last Update: $Id$
#
# 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 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------------

# read eislib etc.
. /var/install/include/check-eisfair-version

# set platform specific parameters
log_file=/var/log/messages
log_tmp_file=/var/log/messages.capi2text

if [ -s ${log_file} ]
then
    # log file exists
    # -h suppress leading file name
    grep -E -h " kernel: capidrv-|kernel: isdn_| listen2fritz[:\[]" ${log_file} > ${log_tmp_file}

    if [ $? -ne 0 ]
    then
        echo "Info: Nothing has been logged until now." > ${log_tmp_file}
    fi
else
    echo "Warning: Logfile ${log_file} not found or empty!" > ${log_tmp_file}
fi