Merge pull request #22 from linuxserver/init-cleanup

Suppress symbol errors, auto-populate default conf version
This commit is contained in:
Adam 2024-02-05 14:08:27 +00:00 committed by GitHub
commit ed5c2aa6eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# Default syslog-ng.conf file which collects all local logs into a
# single file called /var/log/messages tailored to container usage.
@version: 4.1
@version: |VERSION|
@include "scl.conf"
source s_local {

View File

@ -2,12 +2,14 @@
# shellcheck shell=bash
#Copy defaults
SYSLOG_VERSION=$(syslog-ng --version 2>/dev/null | grep "Config version" | awk -F ':' '{print $2}' | tr -d '[:space:]')
if [[ ! -f "/config/syslog-ng.conf" ]]; then
cp -a /defaults/syslog-ng.conf /config/syslog-ng.conf
sed -i "s/|VERSION|/${SYSLOG_VERSION}/" /config/syslog-ng.conf
fi
CONF_VERSION=$(grep -oP "@version: \K(\d+\.\d+)" "/config/syslog-ng.conf")
SYSLOG_VERSION=$(syslog-ng --version | grep "Config version" | awk -F ':' '{print $2}' | tr -d '[:space:]')
if [[ -f "/config/syslog-ng.conf" ]] && (( $(bc -l <<< "${CONF_VERSION} < ${SYSLOG_VERSION}") )); then
cat <<-EOF
@ -21,7 +23,7 @@ cat <<-EOF
* To upgrade the configuration, please review any *
* warnings about incompatible changes in the log. *
* *
* Once completed change the @version header at the *
* Once completed change the @version header at the *
* top of the configuration file to "${SYSLOG_VERSION}" *
* *
* *