23 lines
878 B
Bash
Executable File
23 lines
878 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
DESTDIR=$1
|
|
|
|
echo "splitting the monolithic config into separate sections..." 1>&2
|
|
|
|
for sec in General Alerts Database Presentation Probes Slaves Targets
|
|
do
|
|
if [ ! -f ${DESTDIR}/etc/smokeping/config.d/$sec ]; then
|
|
sed -n "0,/^\*\*\* $sec \*\*\*/{h;d}; \${g;p;q}; /^\*\*\*/{g;p;q}; H" \
|
|
< ${DESTDIR}/etc/smokeping/config > ${DESTDIR}/etc/smokeping/config.d/$sec
|
|
fi
|
|
done
|
|
|
|
egrep 'sendmail|imgcache|imgurl|datadir|dyndir|piddir|smokemail|tmail' ${DESTDIR}/etc/smokeping/config.d/General > ${DESTDIR}/etc/smokeping/config.d/pathnames
|
|
echo 'dyndir = /var/lib/smokeping/__cgi' >> ${DESTDIR}/etc/smokeping/config.d/pathnames
|
|
|
|
sed -i '/sendmail\|imgcache\|imgurl\|datadir\|dyndir\|piddir\|smokemail\|tmail/d' ${DESTDIR}/etc/smokeping/config.d/General
|
|
|
|
echo '@include /etc/smokeping/config.d/pathnames' >> ${DESTDIR}/etc/smokeping/config.d/General
|