blob: b4b3a27b2bca1de102ff52e063ae90d390f603bf [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
Brad Bishop63ae8782019-10-09 09:56:13 -040011
12SRC_URI = " \
13 file://init \
14 file://zram-swap-init \
15 file://zram-swap-deinit \
16 file://zram-swap.service \
17 file://dev-zram0.swap \
18"
19
20do_install () {
21 # Install systemd related configuration file
22 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
23 install -d ${D}${sysconfdir}/init.d
24 install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/zram
25 fi
26
27 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
28 install -d ${D}${libexecdir}
29 install -m 0755 ${WORKDIR}/zram-swap-init ${D}${libexecdir}
30 install -m 0755 ${WORKDIR}/zram-swap-deinit ${D}${libexecdir}
31 install -d ${D}${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/zram-swap.service ${D}${systemd_unitdir}/system/zram-swap.service
33 sed -i -e "s,@LIBEXECDIR@,${libexecdir},g" ${D}${systemd_unitdir}/system/zram-swap.service
34 install -m 0644 ${WORKDIR}/dev-zram0.swap ${D}${systemd_unitdir}/system/dev-zram0.swap
35 fi
36}
37
Patrick Williams213cb262021-08-07 19:21:33 -050038FILES:${PN} = " \
Brad Bishop63ae8782019-10-09 09:56:13 -040039 ${sysconfdir} \
40 ${systemd_unitdir} \
41 ${libexecdir} \
42"
43INITSCRIPT_NAME = "zram"
44INITSCRIPT_PARAMS = "start 05 2 3 4 5 . stop 22 0 1 6 ."
45
Patrick Williams213cb262021-08-07 19:21:33 -050046RPROVIDES:${PN} += "${PN}-systemd"
47RREPLACES:${PN} += "${PN}-systemd"
48RCONFLICTS:${PN} += "${PN}-systemd"
49SYSTEMD_SERVICE:${PN} = "dev-zram0.swap"