alsa-state: revert wrong fix, do that better
[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 = "r5"
11
12 SRC_URI = "\
13   file://asound.conf \
14   file://asound.state \
15   file://alsa-state \
16 "
17
18 inherit update-rc.d
19
20 INITSCRIPT_NAME = "alsa-state"
21 INITSCRIPT_PARAMS = "start 39 S ."
22
23 do_install() {
24     install -d ${D}${sysconfdir}/init.d
25     install -m 0755 ${WORKDIR}/alsa-state ${D}${sysconfdir}/init.d
26
27         install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir}
28         install -m 0644 ${WORKDIR}/*.state ${D}${sysconfdir}
29 }
30
31 PACKAGES += "alsa-states"
32
33 RRECOMMENDS_alsa-state = "alsa-states"
34 RRECOMMENDS_${PN}_om-gta01 = "openmoko-alsa-scenarios"
35 RRECOMMENDS_${PN}_om-gta02 = "openmoko-alsa-scenarios"
36
37 FILES_${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf"
38 CONFFILES_${PN} = "${sysconfdir}/asound.conf"
39
40 FILES_alsa-states = "${sysconfdir}/*.state"
41
42 PACKAGE_ARCH_${PN} = "all"
43 PACKAGE_ARCH_alsa-states = "${MACHINE_ARCH}"
44
45 pkg_postinst_${PN}() {
46         if test -z "$D"
47         then
48                 if test -x /usr/sbin/alsactl
49                 then
50                         /usr/sbin/alsactl -f ${sysconfdir}/asound.state restore
51                 fi
52                 # INITSCRIPT_PARAMS changed, so remove the old and
53                 # install the new setting.
54                 update-rc.d -f ${INITSCRIPT_NAME} remove
55                 update-rc.d ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
56         fi
57 }