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