e48678742fec974164c31601fa9449227628af2f
[vuplus_openembedded] / apmd / apmd_3.2.0.oe
1 SECTION = "base"
2 PRIORITY = "required"
3 MAINTAINER = "Greg Gilbert <greg@treke.net>"
4 DEPENDS = "virtual/libc libtool-cross"
5 DESCRIPTION = "Set of tools for managing notebook power consumption."
6
7 SRC_URI = "${DEBIAN_MIRROR}/main/a/apmd/apmd_${PV}.orig.tar.gz;"
8 SRC_URI_append =" file://${FILESDIR}/apmd_${PV}-3.diff;patch=1"
9 SRC_URI_append =" file://${FILESDIR}/workaround.patch;patch=1"
10 SRC_URI_append =" file://${FILESDIR}/conf.patch;patch=1"
11 SRC_URI_append =" file://${FILESDIR}/proxy.patch;patch=1"
12 SRC_URI_append =" file://${FILESDIR}/compile.patch;patch=1"
13 SRC_URI_append =" file://${FILESDIR}/make.patch;patch=1"
14
15 S = "${WORKDIR}/apmd-${PV}.orig"
16
17 do_compile() {
18         oe_runmake "LIBTOOL=${STAGING_BINDIR}/${TARGET_PREFIX}libtool" apm apmd
19 }
20
21 do_stage() {
22         oe_libinstall -so libapm ${STAGING_LIBDIR}
23 }
24
25 do_install() {
26
27         install -d ${D}/${sysconfdir}
28         install -d ${D}/${sysconfdir}/apm
29         install -d ${D}/${sysconfdir}/apm/event.d
30         install -d ${D}/${sysconfdir}/apm/other.d
31         install -d ${D}/${sysconfdir}/apm/suspend.d
32         install -d ${D}/${sysconfdir}/apm/resume.d
33         install -d ${D}/${sysconfdir}/apm/scripts.d
34         install -d ${D}/${sysconfdir}/default
35         install -d ${D}/${sysconfdir}/init.d
36         install -d ${D}/${sbindir}
37         install -d ${D}/${bindir}
38         install -d ${D}/${libdir}
39         install -d ${D}/${datadir}/apmd
40         install -m 4755 ${S}/.libs/apm ${D}/${bindir}/apm.orig
41         install -m 0755 ${FILESDIR}/apmwrapper ${D}/${bindir}/apm
42         install -m 0755 ${S}/.libs/apmd ${D}/${sbindir}/apmd
43         install -m 0755 ${S}/debian/apmd_proxy ${D}/${sysconfdir}/apm/
44         install -m 0644 ${S}/debian/apmd_proxy.conf ${D}/${datadir}/apmd/
45         install -m 0644 ${S}/debian/apmd.default ${D}/${sysconfdir}/default/apmd
46         oe_libinstall -so libapm ${D}/${libdir}
47
48         cat ${FILESDIR}/init | sed -e 's,/usr/sbin,${sbindir},g; s,/etc,${sysconfdir},g;' > ${D}/${sysconfdir}/init.d/apmd
49         chmod 755 ${D}/${sysconfdir}/init.d/apmd
50 }
51
52 pkg_postinst () {
53         if test -n "${D}"; then
54                 D="-r $D"
55         fi
56         update-rc.d $D apmd defaults
57 }
58
59 pkg_prerm () {
60         if test -n "${D}"; then
61                 D="-r $D"
62         fi
63         update-rc.d $D apmd remove
64 }