blob: c675d3ded87658ef84c6ce07b9d9d12553ae0616 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001require lvm2.inc
2
Brad Bishop0f291cc2019-09-01 15:16:57 -04003SRC_URI += " \
Brad Bishopc1d34332019-09-09 14:56:00 -04004 file://0001-fix-command-bin-findmnt-bin-lsblk-bin-sort-not-found.patch \
Patrick Williams169d7bc2024-01-05 11:33:25 -06005 file://tweak-for-lvmdbusd.patch \
6 file://0001-lvmdbusd-create-dirs-for-lock-file.patch \
Brad Bishop19323692019-04-05 15:28:33 -04007 "
8
9DEPENDS += "autoconf-archive-native"
10
Patrick Williams169d7bc2024-01-05 11:33:25 -060011inherit multilib_script python3native
Brad Bishop19323692019-04-05 15:28:33 -040012
13MULTILIB_SCRIPTS = "${PN}:${sysconfdir}/lvm/lvm.conf"
14
15CACHED_CONFIGUREVARS += "MODPROBE_CMD=${base_sbindir}/modprobe"
16
Patrick Williams213cb262021-08-07 19:21:33 -050017do_install:append() {
Brad Bishop19323692019-04-05 15:28:33 -040018 # Install machine specific configuration file
19 install -d ${D}${sysconfdir}/lvm
20 install -m 0644 ${WORKDIR}/lvm.conf ${D}${sysconfdir}/lvm/lvm.conf
21 sed -i -e 's:@libdir@:${libdir}:g' ${D}${sysconfdir}/lvm/lvm.conf
Andrew Geissler595f6302022-01-24 19:11:47 +000022 # We don't want init scripts/systemd units for native SDK utilities
23 if [ "${PN}" != "nativesdk-lvm2" ]; then
24 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
25 oe_runmake 'DESTDIR=${D}' install install_systemd_units
26 sed -i -e 's:/usr/bin/true:${base_bindir}/true:g' ${D}${systemd_system_unitdir}/blk-availability.service
27 else
28 oe_runmake 'DESTDIR=${D}' install install_initscripts
29 mv ${D}${sysconfdir}/rc.d/init.d ${D}${sysconfdir}/init.d
30 rm -rf ${D}${sysconfdir}/rc.d
31 fi
Brad Bishop19323692019-04-05 15:28:33 -040032 fi
Patrick Williams169d7bc2024-01-05 11:33:25 -060033
34 # following files only exist when package config `dbus` enabled
35 sed -i -e '1s,#!.*python.*,#!${USRBINPATH}/env python3,' \
36 ${D}${sbindir}/lvmdbusd \
37 ${D}${PYTHON_SITEPACKAGES_DIR}/lvmdbusd/lvmdb.py \
38 ${D}${PYTHON_SITEPACKAGES_DIR}/lvmdbusd/lvm_shell_proxy.py \
39 || true
Brad Bishop19323692019-04-05 15:28:33 -040040}
41
42PACKAGE_BEFORE_PN = "${PN}-scripts ${PN}-udevrules"
43
44SYSTEMD_PACKAGES = "${PN}"
Patrick Williams213cb262021-08-07 19:21:33 -050045SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('PACKAGECONFIG', 'dmeventd', 'lvm2-monitor.service dm-event.socket dm-event.service', '', d)} \
Patrick Williams169d7bc2024-01-05 11:33:25 -060046 ${@bb.utils.contains('PACKAGECONFIG', 'dbus', 'lvm2-lvmdbusd.service', '', d)} \
47 blk-availability.service \
48 "
Brad Bishop19323692019-04-05 15:28:33 -040049SYSTEMD_AUTO_ENABLE = "disable"
50
51TARGET_CC_ARCH += "${LDFLAGS}"
52
Patrick Williams213cb262021-08-07 19:21:33 -050053EXTRA_OECONF:append:class-nativesdk = " --with-confdir=${sysconfdir}"
Brad Bishop19323692019-04-05 15:28:33 -040054
Brad Bishop665fd022019-08-26 01:32:28 -040055DEPENDS += "util-linux"
Patrick Williams213cb262021-08-07 19:21:33 -050056LVM2_PACKAGECONFIG:append:class-target = " \
Brad Bishop665fd022019-08-26 01:32:28 -040057 udev \
58"
Patrick Williams169d7bc2024-01-05 11:33:25 -060059
60PACKAGECONFIG[dbus] = "--enable-dbus-service,--disable-dbus-service,,python3-dbus python3-pyudev"
Brad Bishop36a3e3e2019-10-02 13:29:27 -040061PACKAGECONFIG[udev] = "--enable-udev_sync --enable-udev_rules --with-udevdir=${nonarch_base_libdir}/udev/rules.d,--disable-udev_sync --disable-udev_rules,udev,${PN}-udevrules"
Brad Bishop665fd022019-08-26 01:32:28 -040062
Brad Bishop0f291cc2019-09-01 15:16:57 -040063PACKAGES =+ "libdevmapper"
Patrick Williams213cb262021-08-07 19:21:33 -050064FILES:libdevmapper = " \
Brad Bishop0f291cc2019-09-01 15:16:57 -040065 ${libdir}/libdevmapper.so.* \
66 ${sbindir}/dmsetup \
67 ${sbindir}/dmstats \
68"
69
Patrick Williams213cb262021-08-07 19:21:33 -050070FILES:${PN} += " \
Andrew Geissler89770b02020-06-13 10:40:47 -050071 ${libdir}/device-mapper/*.so \
72 ${systemd_system_unitdir}/lvm2-pvscan@.service \
Patrick Williams169d7bc2024-01-05 11:33:25 -060073 ${PYTHON_SITEPACKAGES_DIR}/lvmdbusd \
74 ${datadir}/dbus-1/system-services/com.redhat.lvmdbus1.service \
Andrew Geissler89770b02020-06-13 10:40:47 -050075"
76
Patrick Williams213cb262021-08-07 19:21:33 -050077FILES:${PN}-scripts = " \
Brad Bishop19323692019-04-05 15:28:33 -040078 ${sbindir}/blkdeactivate \
79 ${sbindir}/fsadm \
80 ${sbindir}/lvmconf \
81 ${sbindir}/lvmdump \
82"
83# Specified explicitly for the udev rules, just in case that it does not get picked
84# up automatically:
Patrick Williams213cb262021-08-07 19:21:33 -050085FILES:${PN}-udevrules = "${nonarch_base_libdir}/udev/rules.d"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050086RDEPENDS:${PN} = "bash"
Patrick Williams213cb262021-08-07 19:21:33 -050087RDEPENDS:${PN}-udevrules = "libdevmapper"
88RDEPENDS:${PN}:append:class-target = " libdevmapper"
89RDEPENDS:${PN}:append:class-nativesdk = " libdevmapper"
Brad Bishop19323692019-04-05 15:28:33 -040090
Patrick Williams213cb262021-08-07 19:21:33 -050091RDEPENDS:${PN}-scripts = "${PN} (= ${EXTENDPKGV}) \
Brad Bishopc1d34332019-09-09 14:56:00 -040092 bash \
93 util-linux-lsblk \
94 util-linux-findmnt \
95 coreutils \
96"
Patrick Williams213cb262021-08-07 19:21:33 -050097RRECOMMENDS:${PN}:class-target = "${PN}-scripts (= ${EXTENDPKGV})"
Brad Bishop19323692019-04-05 15:28:33 -040098
Patrick Williams213cb262021-08-07 19:21:33 -050099CONFFILES:${PN} += "${sysconfdir}/lvm/lvm.conf"
Brad Bishop19323692019-04-05 15:28:33 -0400100
Patrick Williams213cb262021-08-07 19:21:33 -0500101SYSROOT_PREPROCESS_FUNCS:append = " remove_libdevmapper_sysroot_preprocess"
Brad Bishop0f291cc2019-09-01 15:16:57 -0400102remove_libdevmapper_sysroot_preprocess() {
103 rm -f ${SYSROOT_DESTDIR}${libdir}/libdevmapper.so* \
104 ${SYSROOT_DESTDIR}${sbindir}/dmsetup \
105 ${SYSROOT_DESTDIR}${sbindir}/dmstats \
106 ${SYSROOT_DESTDIR}${includedir}/libdevmapper.h \
107 ${SYSROOT_DESTDIR}${libdir}/pkgconfig/devmapper.pc
108}
109
Brad Bishop19323692019-04-05 15:28:33 -0400110BBCLASSEXTEND = "native nativesdk"