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