Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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 | SUMMARY = "Alsa scenario files to enable alsa state restoration" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 8 | HOMEPAGE = "http://www.alsa-project.org/" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | DESCRIPTION = "Alsa Scenario Files - an init script and state files to restore \ |
| 10 | sound state at system boot and save it at system shut down." |
| 11 | LICENSE = "MIT" |
| 12 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" |
| 13 | PV = "0.2.0" |
| 14 | PR = "r5" |
| 15 | |
| 16 | SRC_URI = "\ |
| 17 | file://asound.conf \ |
| 18 | file://asound.state \ |
| 19 | file://alsa-state-init \ |
| 20 | " |
| 21 | |
| 22 | S = "${WORKDIR}" |
| 23 | |
| 24 | # As the recipe doesn't inherit systemd.bbclass, we need to set this variable |
| 25 | # manually to avoid unnecessary postinst/preinst generated. |
| 26 | python __anonymous() { |
| 27 | if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): |
| 28 | d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") |
| 29 | } |
| 30 | |
| 31 | inherit update-rc.d |
| 32 | |
| 33 | INITSCRIPT_NAME = "alsa-state" |
| 34 | INITSCRIPT_PARAMS = "start 39 S . stop 31 0 6 ." |
| 35 | |
| 36 | do_install() { |
| 37 | # Only install the init script when 'sysvinit' is in DISTRO_FEATURES. |
| 38 | if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then |
| 39 | sed -i -e "s:#STATEDIR#:${localstatedir}/lib/alsa:g" ${WORKDIR}/alsa-state-init |
| 40 | install -d ${D}${sysconfdir}/init.d |
| 41 | install -m 0755 ${WORKDIR}/alsa-state-init ${D}${sysconfdir}/init.d/alsa-state |
| 42 | fi |
| 43 | |
| 44 | install -d ${D}/${localstatedir}/lib/alsa |
| 45 | install -d ${D}${sysconfdir} |
| 46 | install -m 0644 ${WORKDIR}/asound.conf ${D}${sysconfdir} |
| 47 | install -m 0644 ${WORKDIR}/*.state ${D}${localstatedir}/lib/alsa |
| 48 | } |
| 49 | |
| 50 | PACKAGES += "alsa-states" |
| 51 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 52 | RRECOMMENDS:alsa-state = "alsa-states" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 53 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 54 | RDEPENDS:${PN} = "alsa-utils-alsactl" |
| 55 | FILES:${PN} = "${sysconfdir}/init.d ${sysconfdir}/asound.conf" |
| 56 | CONFFILES:${PN} = "${sysconfdir}/asound.conf" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 58 | FILES:alsa-states = "${localstatedir}/lib/alsa/*.state" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 59 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 60 | pkg_postinst:${PN}() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 61 | if test -z "$D" |
| 62 | then |
| 63 | if test -x ${sbindir}/alsactl |
| 64 | then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 65 | ${sbindir}/alsactl -g -f ${localstatedir}/lib/alsa/asound.state restore |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 66 | fi |
| 67 | fi |
| 68 | } |