diff --git a/packages/addons/service/rsyslog/changelog.txt b/packages/addons/service/rsyslog/changelog.txt new file mode 100755 index 0000000000..9455e1f3c8 --- /dev/null +++ b/packages/addons/service/rsyslog/changelog.txt @@ -0,0 +1,2 @@ +8.0.100 +- Initial addon diff --git a/packages/addons/service/rsyslog/icon/icon_rsyslog.png b/packages/addons/service/rsyslog/icon/icon_rsyslog.png new file mode 100644 index 0000000000..322015c5e0 Binary files /dev/null and b/packages/addons/service/rsyslog/icon/icon_rsyslog.png differ diff --git a/packages/addons/service/rsyslog/package.mk b/packages/addons/service/rsyslog/package.mk new file mode 100644 index 0000000000..b68e36c348 --- /dev/null +++ b/packages/addons/service/rsyslog/package.mk @@ -0,0 +1,59 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +PKG_NAME="rsyslog" +PKG_VERSION="8.21.0" +PKG_REV="100" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="https://github.com/rsyslog" +PKG_URL="http://www.rsyslog.com/files/download/rsyslog/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS_TARGET="toolchain util-linux libestr libfastjson liblognorm librelp zlib libgcrypt liblogging" +PKG_SECTION="service" +PKG_PRIORITY="optional" +PKG_SHORTDESC="Rsyslog: a rocket-fast system for log processing." +PKG_LONGDESC="Rsyslog ($PKG_VERSION) offers high-performance, great security features and a modular design." +PKG_AUTORECONF="yes" + +PKG_IS_ADDON="yes" +PKG_ADDON_NAME="Rsyslog" +PKG_ADDON_TYPE="xbmc.service" +PKG_ADDON_REPOVERSION="8.0" + +PKG_CONFIGURE_OPTS_TARGET="--enable-imfile \ + --enable-imjournal \ + ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes" + +export LIBGCRYPT_CONFIG="$SYSROOT_PREFIX/usr/bin/libgcrypt-config" + +makeinstall_target() { + : +} + +addon() { + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin + cp $PKG_BUILD/.$TARGET_NAME/tools/rsyslogd \ + $ADDON_BUILD/$PKG_ADDON_ID/bin/ + + mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/lib/rsyslog + for l in $(find $PKG_BUILD/.$TARGET_NAME -name *.so) + do + cp $l $ADDON_BUILD/$PKG_ADDON_ID/lib/rsyslog/ + done +} diff --git a/packages/addons/service/rsyslog/source/bin/rsyslog.init b/packages/addons/service/rsyslog/source/bin/rsyslog.init new file mode 100644 index 0000000000..f7ea1ae287 --- /dev/null +++ b/packages/addons/service/rsyslog/source/bin/rsyslog.init @@ -0,0 +1,34 @@ +#!/bin/sh +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +. /etc/profile +oe_setup_addon service.rsyslog + +[ "$RSYSLOG_MANUAL" == "true" ] && exit + +( + if [ ! -z "$RSYSLOG_IP_NAME_FQDN" ] + then + cat "$ADDON_DIR/config/common.conf" + [ "$RSYSLOG_JOURNAL_LOGGING" == "true" ] && cat "$ADDON_DIR/config/journal.conf" + [ "$RSYSLOG_KODI_LOGGING" == "true" ] && cat "$ADDON_DIR/config/kodi.conf" + [ "$RSYSLOG_PROTOCOL" == "UDP" ] && PROTOCOL="@" || PROTOCOL="@@" + echo "*.* $PROTOCOL$RSYSLOG_IP_NAME_FQDN:$RSYSLOG_PORT" + fi +) > "$ADDON_HOME/rsyslog.conf" diff --git a/packages/addons/service/rsyslog/source/config/common.conf b/packages/addons/service/rsyslog/source/config/common.conf new file mode 100644 index 0000000000..69ffd9b641 --- /dev/null +++ b/packages/addons/service/rsyslog/source/config/common.conf @@ -0,0 +1,6 @@ +$ModLoad imuxsock +$OmitLocalLogging on +$AddUnixListenSocket /run/systemd/journal/syslog +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$WorkDirectory /storage/.kodi/temp + diff --git a/packages/addons/service/rsyslog/source/config/journal.conf b/packages/addons/service/rsyslog/source/config/journal.conf new file mode 100644 index 0000000000..caaee11c5b --- /dev/null +++ b/packages/addons/service/rsyslog/source/config/journal.conf @@ -0,0 +1,3 @@ +$ModLoad imjournal +$ModLoad imklog + diff --git a/packages/addons/service/rsyslog/source/config/kodi.conf b/packages/addons/service/rsyslog/source/config/kodi.conf new file mode 100644 index 0000000000..6bb4f9c57e --- /dev/null +++ b/packages/addons/service/rsyslog/source/config/kodi.conf @@ -0,0 +1,65 @@ +$ModLoad imfile +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity emerg +$InputFileFacility local0 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity alert +$InputFileFacility local1 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity crit +$InputFileFacility local2 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity error +$InputFileFacility local3 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity warning +$InputFileFacility local4 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity notice +$InputFileFacility local5 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity info +$InputFileFacility local6 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + +$InputFileName /storage/.kodi/temp/kodi.log +$InputFileTag kodi +$InputFileStateFile kodi +$InputFileSeverity debug +$InputFileFacility local7 +$InputRunFileMonitor +$InputFilePersistStateInterval 1 + diff --git a/packages/addons/service/rsyslog/source/default.py b/packages/addons/service/rsyslog/source/default.py new file mode 100644 index 0000000000..3999a0eb31 --- /dev/null +++ b/packages/addons/service/rsyslog/source/default.py @@ -0,0 +1,35 @@ +################################################################################ +# This file is part of LibreELEC - https://libreelec.tv +# Copyright (C) 2016 Team LibreELEC +# +# LibreELEC 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. +# +# LibreELEC 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 LibreELEC. If not, see . +################################################################################ + +import subprocess +import xbmc +import xbmcaddon + + +class Monitor(xbmc.Monitor): + + def __init__(self, *args, **kwargs): + xbmc.Monitor.__init__(self) + self.id = xbmcaddon.Addon().getAddonInfo('id') + + def onSettingsChanged(self): + subprocess.call(['systemctl', 'restart', self.id]) + + +if __name__ == "__main__": + Monitor().waitForAbort() diff --git a/packages/addons/service/rsyslog/source/resources/language/English/strings.po b/packages/addons/service/rsyslog/source/resources/language/English/strings.po new file mode 100644 index 0000000000..4f8d2f8479 --- /dev/null +++ b/packages/addons/service/rsyslog/source/resources/language/English/strings.po @@ -0,0 +1,32 @@ +# Kodi Media Center language file +# Addon Name: service.rsyslog +msgid "" +msgstr "" + +msgctxt "#30000" +msgid "Configuration" +msgstr "" + +msgctxt "#30001" +msgid "Configure rsyslog.conf manually" +msgstr "" + +msgctxt "#30002" +msgid "IP | Name | FQDN" +msgstr "" + +msgctxt "#30003" +msgid "Port" +msgstr "" + +msgctxt "#30004" +msgid "Protocol" +msgstr "" + +msgctxt "#30005" +msgid "Log journal and kernel" +msgstr "" + +msgctxt "#30006" +msgid "Log Kodi" +msgstr "" diff --git a/packages/addons/service/rsyslog/source/resources/settings.xml b/packages/addons/service/rsyslog/source/resources/settings.xml new file mode 100644 index 0000000000..a7dc15674f --- /dev/null +++ b/packages/addons/service/rsyslog/source/resources/settings.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/packages/addons/service/rsyslog/source/settings-default.xml b/packages/addons/service/rsyslog/source/settings-default.xml new file mode 100644 index 0000000000..3e3fbda1e0 --- /dev/null +++ b/packages/addons/service/rsyslog/source/settings-default.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/addons/service/rsyslog/source/system.d/service.rsyslog.service b/packages/addons/service/rsyslog/source/system.d/service.rsyslog.service new file mode 100644 index 0000000000..510be4c7b1 --- /dev/null +++ b/packages/addons/service/rsyslog/source/system.d/service.rsyslog.service @@ -0,0 +1,16 @@ +[Unit] +Description=System Logging Service +Requires=syslog.socket +Documentation=http://www.rsyslog.com/doc/ + +[Service] +Type=notify +Environment=RSYSLOG_MODDIR=/storage/.kodi/addons/service.rsyslog/lib/rsyslog/ +ExecStartPre=/bin/sh /storage/.kodi/addons/service.rsyslog/bin/rsyslog.init +ExecStart=/storage/.kodi/addons/service.rsyslog/bin/rsyslogd -n -f /storage/.kodi/userdata/addon_data/service.rsyslog/rsyslog.conf +StandardOutput=null +Restart=on-failure + +[Install] +WantedBy=kodi.target +Alias=syslog.service