summaryrefslogtreecommitdiff
path: root/apmd/apmd_3.2.0.oe
blob: a55bf1d6ffd555badb13a2334f0d18a8757f9493 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
SECTION = "base"
PRIORITY = "required"
MAINTAINER = "Greg Gilbert <greg@treke.net>"
RDEPENDS = "libc6"
DEPENDS = "virtual/libc"

SRC_URI = "${DEBIAN_MIRROR}/main/a/${PN}/${PN}_${PV}.orig.tar.gz;"
SRC_URI_append =" file://${FILESDIR}/${PN}_${PV}-3.diff;patch=1"
SRC_URI_append =" file://${FILESDIR}/workaround.patch;patch=1"
SRC_URI_append =" file://${FILESDIR}/conf.patch;patch=1"
SRC_URI_append =" file://${FILESDIR}/proxy.patch;patch=1"
SRC_URI_append =" file://${FILESDIR}/compile.patch;patch=1"
SRC_URI_append =" file://${FILESDIR}/make.patch;patch=1"

S = "${WORKDIR}/apmd-${PV}.orig"

inherit libtool

do_compile() {
    if [ -e ${STAGING_BINDIR}/${TARGET_SYS}-libtool ]; then
        LIBTOOL=${STAGING_BINDIR}/${TARGET_SYS}-libtool
    else
        LIBTOOL=libtool
    fi
    oe_runmake "LIBTOOL=$LIBTOOL" apm apmd
}

do_stage() {
    install -m 0755 .libs/libapm.so.1.0.0 ${STAGING_LIBDIR};
}

do_install() {

    install -d ${D}/${sysconfdir}
    install -d ${D}/${sysconfdir}/apm
    install -d ${D}/${sysconfdir}/apm/event.d
    install -d ${D}/${sysconfdir}/apm/other.d
    install -d ${D}/${sysconfdir}/apm/suspend.d
    install -d ${D}/${sysconfdir}/apm/resume.d
    install -d ${D}/${sysconfdir}/apm/scripts.d
    install -d ${D}/${sysconfdir}/default
    install -d ${D}/${sysconfdir}/init.d
    install -d ${D}/${sbindir}
    install -d ${D}/${bindir}
    install -d ${D}/${libdir}
    install -d ${D}/${datadir}/apmd
    install -m 4755 ${S}/.libs/apm ${D}/${bindir}/apm.orig
    install -m 0755 ${FILESDIR}/apmwrapper ${D}/${bindir}/apm
    install -m 0755 ${S}/.libs/apmd ${D}/${sbindir}/apmd
    install -m 0755 ${S}/debian/apmd_proxy ${D}/${sysconfdir}/apm/
    install -m 0644 ${S}/debian/apmd_proxy.conf ${D}/${datadir}/apmd/
    install -m 0644 ${S}/debian/apmd.default ${D}/${sysconfdir}/default/apmd
    install -m 0755 .libs/libapm.so.1.0.0 ${D}/${libdir}
    ln -sf ./libapm.so.1.0.0 ${D}/${libdir}/libapm.so.1.0
    ln -sf ./libapm.so.1.0.0 ${D}/${libdir}/libapm.so.1
                
    cat ${FILESDIR}/init | sed -e 's,/usr/sbin,${sbindir},g; s,/etc,${sysconfdir},g;' > ${D}/${sysconfdir}/init.d/apmd
    chmod 755 ${D}/${sysconfdir}/init.d/apmd
}

pkg_postinst () {
	if test -n "$D"; then
		D="-r $D"
	fi
	update-rc.d $D apmd defaults
}

pkg_prerm () {
	if test -n "$D"; then
		D="-r $D"
	fi
	update-rc.d $D apmd remove
}