Brad Bishop | 63ae878 | 2019-10-09 09:56:13 -0400 | [diff] [blame] | 1 | SUMMARY = "Linux zram compressed in-memory swap" |
| 2 | LICENSE = "MIT" |
| 3 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" |
| 4 | |
| 5 | inherit update-rc.d systemd |
| 6 | |
| 7 | RDEPENDS_${PN} = "kmod \ |
| 8 | ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux','util-linux-swaponoff',d)}" |
| 9 | RRECOMMENDS_${PN} = "kernel-module-zram" |
| 10 | |
| 11 | PR = "r3" |
| 12 | |
| 13 | SRC_URI = " \ |
| 14 | file://init \ |
| 15 | file://zram-swap-init \ |
| 16 | file://zram-swap-deinit \ |
| 17 | file://zram-swap.service \ |
| 18 | file://dev-zram0.swap \ |
| 19 | " |
| 20 | |
| 21 | do_install () { |
| 22 | # Install systemd related configuration file |
| 23 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then |
| 24 | install -d ${D}${sysconfdir}/init.d |
| 25 | install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/zram |
| 26 | fi |
| 27 | |
| 28 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 29 | install -d ${D}${libexecdir} |
| 30 | install -m 0755 ${WORKDIR}/zram-swap-init ${D}${libexecdir} |
| 31 | install -m 0755 ${WORKDIR}/zram-swap-deinit ${D}${libexecdir} |
| 32 | install -d ${D}${systemd_unitdir}/system |
| 33 | install -m 0644 ${WORKDIR}/zram-swap.service ${D}${systemd_unitdir}/system/zram-swap.service |
| 34 | sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" ${D}${systemd_unitdir}/system/zram-swap.service |
| 35 | install -m 0644 ${WORKDIR}/dev-zram0.swap ${D}${systemd_unitdir}/system/dev-zram0.swap |
| 36 | fi |
| 37 | } |
| 38 | |
| 39 | FILES_${PN} = " \ |
| 40 | ${sysconfdir} \ |
| 41 | ${systemd_unitdir} \ |
| 42 | ${libexecdir} \ |
| 43 | " |
| 44 | INITSCRIPT_NAME = "zram" |
| 45 | INITSCRIPT_PARAMS = "start 05 2 3 4 5 . stop 22 0 1 6 ." |
| 46 | |
| 47 | RPROVIDES_${PN} += "${PN}-systemd" |
| 48 | RREPLACES_${PN} += "${PN}-systemd" |
| 49 | RCONFLICTS_${PN} += "${PN}-systemd" |
| 50 | SYSTEMD_SERVICE_${PN} = "dev-zram0.swap" |