aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/syslog-ng/syslog-ng.inc
blob: f12791dddd4adc5be99516e1f7ded24f3827e252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
DESCRIPTION = "Alternative system logger daemon"
DEPENDS = "libol flex eventlog glib-2.0"

# syslog initscript is handled explicitly because order of
# update-rc.d and update-alternatives is important
DEPENDS_append = " update-rc.d update-rc.d-native"
RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"

INC_PR = "r4"

inherit autotools

EXTRA_OECONF = "--with-libol=${STAGING_BINDIR_CROSS}/ --enable-dynamic-linking"

do_install_append() {
        install -d ${D}/${sysconfdir}/${PN}
        install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${PN}.conf
        install -d ${D}/${sysconfdir}/init.d
        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
}

CONFFILES_${PN} = "${sysconfdir}/${PN}.conf"

pkg_postinst_${PN} () {
        update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 200

        if test "x$D" != "x"; then
                OPT="-r $D"
        else
                OPT="-s"
        fi
        # remove all rc.d-links potentially created from alternative
        # syslog packages before creating new ones
        update-rc.d $OPT -f syslog remove
        update-rc.d $OPT syslog start 20 2 3 4 5 . stop 90 0 1 6 .
}

pkg_prerm_${PN} () {
        if test "x$D" = "x"; then
                if test "$1" = "upgrade" -o "$1" = "remove"; then
                        /etc/init.d/syslog stop
                fi
        fi

        update-alternatives --remove syslog-init syslog.${PN}
}

pkg_postrm_${PN} () {
        if test "x$D" != "x"; then
                OPT="-r $D"
        else
                OPT=""
        fi
        if test "$1" = "remove" -o "$1" = "purge"; then
                if ! test -e "/etc/init.d/syslog"; then
                        update-rc.d $OPT syslog remove
                fi
        fi
}