Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 1 | require util-linux.inc |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 3 | #gtk-doc is not enabled as it requires xmlto which requires util-linux |
Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame^] | 4 | inherit autotools gettext pkgconfig systemd update-alternatives python3-dir bash-completion ptest |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 5 | DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | PACKAGES =+ "${PN}-swaponoff" |
| 8 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 10 | python util_linux_binpackages () { |
| 11 | def pkg_hook(f, pkg, file_regex, output_pattern, modulename): |
| 12 | pn = d.getVar('PN') |
| 13 | d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 15 | if d.getVar('ALTERNATIVE_' + pkg): |
| 16 | return |
| 17 | if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): |
| 18 | d.setVar('ALTERNATIVE_' + pkg, modulename) |
| 19 | |
| 20 | bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) |
| 21 | for dir in bindirs: |
| 22 | do_split_packages(d, root=dir, |
| 23 | file_regex=r'(.*)', output_pattern='${PN}-%s', |
| 24 | description='${PN} %s', |
| 25 | hook=pkg_hook, extra_depends='') |
| 26 | |
| 27 | # There are some symlinks for some binaries which we have ignored |
| 28 | # above. Add them to the package owning the binary they are |
| 29 | # pointing to |
| 30 | extras = {} |
| 31 | dvar = d.getVar('PKGD') |
| 32 | for root in bindirs: |
| 33 | for walkroot, dirs, files in os.walk(dvar + root): |
| 34 | for f in files: |
| 35 | file = os.path.join(walkroot, f) |
| 36 | if not os.path.islink(file): |
| 37 | continue |
| 38 | |
| 39 | pkg = os.path.basename(os.readlink(file)) |
| 40 | extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1) |
| 41 | |
| 42 | pn = d.getVar('PN') |
| 43 | for pkg, links in extras.items(): |
| 44 | of = d.getVar('FILES_' + pn + '-' + pkg) |
| 45 | links = of + links |
| 46 | d.setVar('FILES_' + pn + '-' + pkg, links) |
| 47 | } |
| 48 | |
| 49 | # we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS |
| 50 | PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages " |
| 51 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 52 | # skip libuuid as it will be packaged by the util-linux-libuuid recipe |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 53 | python util_linux_libpackages() { |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 54 | do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$', |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 55 | output_pattern='${PN}-lib%s', |
| 56 | description='${PN} lib%s', |
| 57 | extra_depends='', prepend=True, allow_links=True) |
| 58 | } |
| 59 | |
| 60 | PACKAGESPLITFUNCS =+ "util_linux_libpackages" |
| 61 | |
| 62 | PACKAGES_DYNAMIC = "^${PN}-.*" |
| 63 | |
| 64 | CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms" |
| 65 | UTIL_LINUX_LIBDIR = "${libdir}" |
| 66 | UTIL_LINUX_LIBDIR_class-target = "${base_libdir}" |
| 67 | EXTRA_OECONF = "\ |
| 68 | --enable-libuuid --enable-libblkid \ |
| 69 | \ |
| 70 | --enable-fsck --enable-kill --enable-last --enable-mesg \ |
| 71 | --enable-mount --enable-partx --enable-raw --enable-rfkill \ |
| 72 | --enable-unshare --enable-write \ |
| 73 | \ |
| 74 | --disable-bfs --disable-chfn-chsh --disable-login \ |
| 75 | --disable-makeinstall-chown --disable-minix --disable-newgrp \ |
| 76 | --disable-use-tty-group --disable-vipw \ |
| 77 | \ |
| 78 | --without-udev \ |
| 79 | \ |
| 80 | usrsbin_execdir='${sbindir}' \ |
| 81 | --libdir='${UTIL_LINUX_LIBDIR}' \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 82 | " |
| 83 | |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 84 | EXTRA_OECONF_append_class-target = " --enable-setpriv" |
| 85 | EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" |
| 86 | EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 87 | EXTRA_OECONF_append = " --disable-hwclock-gplv3" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 88 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 89 | # enable pcre2 for native/nativesdk to match host distros |
| 90 | # this helps to keep same expectations when using the SDK or |
| 91 | # build host versions during development |
| 92 | # |
| 93 | PACKAGECONFIG ?= "pcre2" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 94 | PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 95 | PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam," |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 96 | # Respect the systemd feature for uuidd |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 97 | PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 98 | # Build python bindings for libmount |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 99 | PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 100 | # Readline support |
| 101 | PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 102 | # PCRE support in hardlink |
| 103 | PACKAGECONFIG[pcre2] = ",,libpcre2" |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 104 | PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 105 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 106 | EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" |
| 107 | |
| 108 | ALLOW_EMPTY_${PN} = "1" |
| 109 | FILES_${PN} = "" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 111 | FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 112 | FILES_${PN}-mount = "${sysconfdir}/default/mountall" |
| 113 | FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*" |
| 114 | FILES_${PN}-su = "${sysconfdir}/pam.d/su-l" |
| 115 | CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l" |
| 116 | FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ |
| 117 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ |
| 118 | ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 119 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 120 | # Util-linux' blkid replaces the e2fsprogs one |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 121 | RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" |
| 122 | RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 123 | |
| 124 | RRECOMMENDS_${PN}_class-native = "" |
| 125 | RRECOMMENDS_${PN}_class-nativesdk = "" |
| 126 | RDEPENDS_${PN}_class-native = "" |
| 127 | RDEPENDS_${PN}_class-nativesdk = "" |
| 128 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 129 | RDEPENDS_${PN} += " util-linux-libuuid" |
| 130 | RDEPENDS_${PN}-dev += " util-linux-libuuid-dev" |
| 131 | |
| 132 | RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 133 | |
| 134 | RDEPENDS_${PN}-bash-completion += "${PN}-lsblk" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 135 | RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz" |
| 136 | RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 137 | RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" |
| 138 | ALLOW_EMPTY_${PN}-swaponoff = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 139 | |
| 140 | #SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" |
| 141 | SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" |
| 142 | SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" |
| 143 | SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" |
| 144 | SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" |
| 145 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 146 | do_install () { |
| 147 | # with ccache the timestamps on compiled files may |
| 148 | # end up earlier than on their inputs, this allows |
| 149 | # for the resultant compilation in the install step. |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 150 | oe_runmake 'CC=${CC}' 'LD=${LD}' \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 151 | 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install |
| 152 | |
| 153 | mkdir -p ${D}${base_bindir} |
| 154 | |
| 155 | sbinprogs="agetty ctrlaltdel cfdisk vipw vigr" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 156 | sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 157 | binprogs_a="dmesg getopt kill more umount mount login su mountpoint" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | |
| 159 | if [ "${base_sbindir}" != "${sbindir}" ]; then |
| 160 | mkdir -p ${D}${base_sbindir} |
| 161 | for p in $sbinprogs $sbinprogs_a; do |
| 162 | if [ -f "${D}${sbindir}/$p" ]; then |
| 163 | mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p" |
| 164 | fi |
| 165 | done |
| 166 | fi |
| 167 | |
| 168 | if [ "${base_bindir}" != "${bindir}" ]; then |
| 169 | mkdir -p ${D}${base_bindir} |
| 170 | for p in $binprogs_a; do |
| 171 | if [ -f "${D}${bindir}/$p" ]; then |
| 172 | mv "${D}${bindir}/$p" "${D}${base_bindir}/$p" |
| 173 | fi |
| 174 | done |
| 175 | fi |
| 176 | |
| 177 | install -d ${D}${sysconfdir}/default/ |
| 178 | echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall |
| 179 | |
| 180 | rm -f ${D}${bindir}/chkdupexe |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 181 | } |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 182 | |
Brad Bishop | c68388fc | 2019-08-26 01:33:31 -0400 | [diff] [blame] | 183 | do_install_append_class-target () { |
| 184 | if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 185 | install -d ${D}${sysconfdir}/pam.d |
| 186 | install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser |
| 187 | install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 188 | # Required for "su -" aka "su --login" because |
| 189 | # otherwise it uses "other", which has "auth pam_deny.so" |
| 190 | # and thus prevents the operation. |
| 191 | ln -s su ${D}${sysconfdir}/pam.d/su-l |
| 192 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 193 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 194 | # nologin causes a conflict with shadow-native |
| 195 | # kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 196 | do_install_append_class-native () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 197 | rm -f ${D}${base_sbindir}/nologin |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 198 | rm -f ${D}${base_bindir}/kill |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 199 | } |
| 200 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 201 | # dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds |
| 202 | # Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it |
| 203 | do_install_append () { |
| 204 | rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid* |
| 205 | } |
| 206 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 207 | ALTERNATIVE_PRIORITY = "80" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 208 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 209 | ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 210 | ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 211 | ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 212 | ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" |
| 213 | ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 214 | ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 215 | ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 216 | ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" |
| 217 | ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" |
| 218 | ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 219 | ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 220 | ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" |
| 221 | ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" |
| 222 | ALTERNATIVE_${PN}-agetty = "getty" |
| 223 | ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" |
| 224 | ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" |
| 225 | ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" |
| 226 | ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" |
| 227 | ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" |
| 228 | ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" |
| 229 | ALTERNATIVE_${PN}-last = "last lastb" |
| 230 | ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" |
| 231 | ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" |
| 232 | ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" |
| 233 | ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup" |
| 234 | ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg" |
| 235 | ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 236 | ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 237 | ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more" |
| 238 | ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount" |
| 239 | ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 240 | ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 241 | ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter" |
| 242 | ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 243 | ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 244 | ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile" |
| 245 | ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice" |
| 246 | ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" |
| 247 | ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" |
Andrew Geissler | 4ed12e1 | 2020-06-05 18:00:41 -0500 | [diff] [blame] | 248 | ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 249 | ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 250 | ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" |
| 251 | ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" |
| 252 | ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin" |
| 253 | ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff" |
| 254 | ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon" |
| 255 | ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root" |
| 256 | ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset" |
| 257 | ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount" |
| 258 | ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare" |
| 259 | ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 260 | ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 261 | ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 262 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 263 | BBCLASSEXTEND = "native nativesdk" |
| 264 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 265 | PTEST_BINDIR = "1" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 266 | do_compile_ptest() { |
| 267 | oe_runmake buildtest-TESTS |
| 268 | } |
| 269 | |
| 270 | do_install_ptest() { |
| 271 | mkdir -p ${D}${PTEST_PATH}/tests/ts |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 272 | find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; |
| 273 | find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; |
| 274 | find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 275 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 276 | cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/ |
| 277 | cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected |
| 278 | cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ |
| 279 | cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} |
| 280 | |
| 281 | # The original paths of executables to be tested point to a local folder containing |
| 282 | # the executables. We want to test the installed executables, not the local copies. |
| 283 | # So strip the paths, the executables will be located via "which" |
| 284 | sed -i \ |
| 285 | -e '/^TS_CMD/ s|$top_builddir/||g' \ |
| 286 | -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \ |
| 287 | ${D}${PTEST_PATH}/tests/commands.sh |
| 288 | |
| 289 | # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]' |
| 290 | sed -i -e \ |
| 291 | '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \ |
| 292 | ${D}${PTEST_PATH}/tests/functions.sh |
| 293 | |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 294 | # Running "kill" without the the complete path would use the shell's built-in kill |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 295 | sed -i -e \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 296 | '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 297 | ${D}${PTEST_PATH}/tests/commands.sh |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 298 | |
| 299 | |
| 300 | sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest |
| 301 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 302 | } |