blob: 98c47af7acdd56a5661f53d211b0f4480b542a1a [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
7RDEPENDS_${PN} = "kmod \
8 ${@bb.utils.contains('DISTRO_FEATURES','systemd','util-linux','util-linux-swaponoff',d)}"
9RRECOMMENDS_${PN} = "kernel-module-zram"
10
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
39FILES_${PN} = " \
40 ${sysconfdir} \
41 ${systemd_unitdir} \
42 ${libexecdir} \
43"
44INITSCRIPT_NAME = "zram"
45INITSCRIPT_PARAMS = "start 05 2 3 4 5 . stop 22 0 1 6 ."
46
47RPROVIDES_${PN} += "${PN}-systemd"
48RREPLACES_${PN} += "${PN}-systemd"
49RCONFLICTS_${PN} += "${PN}-systemd"
50SYSTEMD_SERVICE_${PN} = "dev-zram0.swap"