File: split_config

package info (click to toggle)
smokeping 2.8.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,356 kB
  • sloc: perl: 17,637; sh: 3,884; makefile: 156; javascript: 114
file content (22 lines) | stat: -rwxr-xr-x 878 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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