rename packages/ to recipes/ per earlier agreement
[vuplus_openembedded] / recipes / alsa / alsa-state.bb
1 # Copyright Matthias Hentges <devel@hentges.net> (c) 2007
2 # License: MIT (see http://www.opensource.org/licenses/mit-license.php
3 #               for a copy of the license)
4 #
5 # Filename: alsa-state.bb
6
7 DESCRIPTION = "Alsa Scenario Files"
8 LICENSE = "MIT"
9 PV = "0.2.0"
10 PR = "r3"
11
12 SRC_URI = "\
13   file://asound.conf \
14   file://asound.state \
15   file://alsa-state \
16   file://*.state \
17 "
18
19 inherit update-rc.d
20
21 INITSCRIPT_NAME = "alsa-state"
22 INITSCRIPT_PARAMS = "start 39 S ."
23
24 do_install() {
25     install -d ${D}${sysconfdir}/init.d
26     install -m 0755 ${WORKDIR}/alsa-state ${D}${sysconfdir}/init.d
27
28         install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir}
29         install -m 0644 ${WORKDIR}/*.state ${D}${sysconfdir}
30 }
31
32 PACKAGES += "alsa-states"
33
34 RRECOMMENDS_alsa-state = "alsa-states"
35 RRECOMMENDS_${PN}_om-gta01 = "openmoko-alsa-scenarios"
36 RRECOMMENDS_${PN}_om-gta02 = "openmoko-alsa-scenarios"
37
38 FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf"
39 CONFFILES_${PN} = "${sysconfdir}/asound.conf"
40
41 FILES_alsa-states = "${sysconfdir}/*.state"
42
43 PACKAGE_ARCH_${PN} = "all"
44 PACKAGE_ARCH_alsa-states = "${MACHINE_ARCH}"
45
46 pkg_postinst_${PN}() {
47         if test -z "$D"
48         then
49                 if test -x /usr/sbin/alsactl
50                 then
51                         /usr/sbin/alsactl -f ${sysconfdir}/asound.state restore
52                 fi
53                 # INITSCRIPT_PARAMS changed, so remove the old and
54                 # install the new setting.
55                 update-rc.d -f ${INITSCRIPT_NAME} remove
56                 update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
57         fi
58 }