Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

Commit

Permalink
rsyslogd: fixed szarp-base package configuration on some systems
Browse files Browse the repository at this point in the history
* rsyslog is not required by SZARP, so szarp-base package should be able
  to successfully finish 'configure' step without rsyslogd.
  • Loading branch information
tphaster committed May 25, 2016
1 parent 60dbffc commit 25def3f
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions debian/szarp-base.postinst
Expand Up @@ -11,17 +11,28 @@ case "$1" in
configure)

# apply appropriate discard action directive in rsyslogd configuration
RSYSLOG_TEM="/opt/szarp/resources/rsyslog_conf_TEMPLATE"
RSYSLOG_CFG="/etc/rsyslog.d/szarp.conf"
RSYSLOG_VER=$(/usr/sbin/rsyslogd -v | awk 'NR==1{print $2}' | awk -F'.' '{print $1}')

if [ -f "$RSYSLOG_TEM" ]; then
if [ "$RSYSLOG_VER" -gt 6 ]; then
sed 's/DISCARD_ACTION/stop/' "$RSYSLOG_TEM" > "$RSYSLOG_CFG"
if command -v "rsyslogd" >/dev/null 2>&1; then
echo "Installing rsyslogd configuration for SZARP..."

RSYSLOG_TEM="/opt/szarp/resources/rsyslog_conf_TEMPLATE"
RSYSLOG_CFG="/etc/rsyslog.d/szarp.conf"
RSYSLOG_VER=$(rsyslogd -v | awk 'NR==1{print $2}' | awk -F'.' '{print $1}')

if [ -f "$RSYSLOG_TEM" ] && [ -d "$(dirname "$RSYSLOG_CFG")" ]; then
if [ "$RSYSLOG_VER" -gt 6 ]; then
sed 's/DISCARD_ACTION/stop/' "$RSYSLOG_TEM" > "$RSYSLOG_CFG"
else
# tidle character is deprecated since version 7
sed 's/DISCARD_ACTION/~/' "$RSYSLOG_TEM" > "$RSYSLOG_CFG"
fi

echo "Configuration for rsyslogd successfully installed."
else
# tidle character is deprecated since version 7
sed 's/DISCARD_ACTION/~/' "$RSYSLOG_TEM" > "$RSYSLOG_CFG"
echo "ERROR: failed to install rsyslogd configuration for SZARP. Abort."
exit 1
fi
else
echo "WARNING: no rsyslogd found, SZARP-specific configuration will not be installed."
fi

/opt/szarp/bin/install_vim || true
Expand Down

0 comments on commit 25def3f

Please sign in to comment.