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 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 7 | RDEPENDS:${PN} = "kmod \ |
Brad Bishop | 63ae878 | 2019-10-09 09:56:13 -0400 | [diff] [blame] | 8 | ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux','util-linux-swaponoff',d)}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 9 | RRECOMMENDS:${PN} = "kernel-module-zram" |
Brad Bishop | 63ae878 | 2019-10-09 09:56:13 -0400 | [diff] [blame] | 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 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | FILES:${PN} = " \ |
Brad Bishop | 63ae878 | 2019-10-09 09:56:13 -0400 | [diff] [blame] | 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 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 47 | RPROVIDES:${PN} += "${PN}-systemd" |
| 48 | RREPLACES:${PN} += "${PN}-systemd" |
| 49 | RCONFLICTS:${PN} += "${PN}-systemd" |
| 50 | SYSTEMD_SERVICE:${PN} = "dev-zram0.swap" |