mirror of
https://github.com/linuxserver/docker-syslog-ng.git
synced 2026-03-09 00:04:57 +08:00
Merge pull request #22 from linuxserver/init-cleanup
Suppress symbol errors, auto-populate default conf version
This commit is contained in:
commit
ed5c2aa6eb
@ -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 {
|
||||
|
||||
@ -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}" *
|
||||
* *
|
||||
* *
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user