blob: 97db34134e40d81323234148dbb556d748099981 [file] [log] [blame]
Brad Bishop63ae8782019-10-09 09:56:13 -04001SUMMARY = "Linux zram compressed in-memory swap"
2LICENSE = "MIT"
3LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
4
5inherit update-rc.d systemd
6
Patrick Williams213cb262021-08-07 19:21:33 -05007RDEPENDS:${PN} = "kmod \
Brad Bishop63ae8782019-10-09 09:56:13 -04008 ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux','util-linux-swaponoff',d)}"
Patrick Williams213cb262021-08-07 19:21:33 -05009RRECOMMENDS:${PN} = "kernel-module-zram"
Brad Bishop63ae8782019-10-09 09:56:13 -040010
11PR = "r3"
12
13SRC_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
21do_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 Williams213cb262021-08-07 19:21:33 -050039FILES:${PN} = " \
Brad Bishop63ae8782019-10-09 09:56:13 -040040 ${sysconfdir} \
41 ${systemd_unitdir} \
42 ${libexecdir} \
43"
44INITSCRIPT_NAME = "zram"
45INITSCRIPT_PARAMS = "start 05 2 3 4 5 . stop 22 0 1 6 ."
46
Patrick Williams213cb262021-08-07 19:21:33 -050047RPROVIDES:${PN} += "${PN}-systemd"
48RREPLACES:${PN} += "${PN}-systemd"
49RCONFLICTS:${PN} += "${PN}-systemd"
50SYSTEMD_SERVICE:${PN} = "dev-zram0.swap"