Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "A suite of basic system administration utilities" |
| 2 | DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \ |
| 3 | commonly found on most Linux systems. Some of the more important utilities include \ |
| 4 | disk partitioning, kernel message management, filesystem creation, and system login." |
| 5 | |
| 6 | SECTION = "base" |
| 7 | |
| 8 | LICENSE = "GPLv2+ & LGPLv2.1+ & BSD" |
| 9 | |
| 10 | LIC_FILES_CHKSUM = "file://README.licensing;md5=1715f5ee3e01203ca1e1e0b9ee65918c \ |
| 11 | file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 12 | file://Documentation/licenses/COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 13 | file://Documentation/licenses/COPYING.LGPLv2.1;md5=4fbd65380cdd255951079008b364516c \ |
| 14 | file://Documentation/licenses/COPYING.BSD-3;md5=58dcd8452651fc8b07d1f65ce07ca8af \ |
| 15 | file://Documentation/licenses/COPYING.UCB;md5=263860f8968d8bafa5392cab74285262 \ |
| 16 | file://libuuid/COPYING;md5=b442ffb762cf8d3e9df1b99e0bb4af70 \ |
| 17 | file://libmount/COPYING;md5=fb93f01d4361069c5616327705373b16 \ |
| 18 | file://libblkid/COPYING;md5=fb93f01d4361069c5616327705373b16" |
| 19 | |
| 20 | inherit autotools gettext pkgconfig systemd update-alternatives python-dir |
| 21 | DEPENDS = "zlib ncurses" |
| 22 | DEPENDS_append_class-native = " lzo-native" |
| 23 | DEPENDS_append_class-nativesdk = " lzo-native" |
| 24 | |
| 25 | SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \ |
| 26 | " |
| 27 | |
| 28 | PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \ |
| 29 | util-linux-swaponoff util-linux-losetup util-linux-umount \ |
| 30 | util-linux-mount util-linux-readprofile util-linux-uuidd \ |
| 31 | util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \ |
| 32 | util-linux-mkfs util-linux-mcookie util-linux-reset \ |
| 33 | util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \ |
| 34 | util-linux-partx ${PN}-bash-completion util-linux-hwclock \ |
| 35 | util-linux-findfs util-linux-getopt util-linux-sulogin" |
| 36 | PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}" |
| 37 | |
| 38 | PACKAGES_DYNAMIC = "^util-linux-lib.*" |
| 39 | |
| 40 | SHARED_EXTRA_OECONF = "--disable-use-tty-group \ |
| 41 | --disable-makeinstall-chown \ |
| 42 | --enable-kill --enable-last --enable-mesg --enable-partx \ |
| 43 | --enable-raw --enable-reset --disable-login \ |
| 44 | --disable-vipw --disable-newgrp --disable-chfn-chsh \ |
| 45 | --enable-write --enable-mount \ |
| 46 | --enable-libuuid --enable-libblkid --enable-fsck --without-udev \ |
| 47 | usrsbin_execdir='${sbindir}' \ |
| 48 | " |
| 49 | |
| 50 | EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}" |
| 51 | |
| 52 | PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" |
| 53 | PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam," |
| 54 | |
| 55 | # Respect the systemd feature for uuidd |
| 56 | PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemd --without-systemdsystemunitdir,systemd" |
| 57 | |
| 58 | # Build setpriv requires libcap-ng |
| 59 | PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng," |
| 60 | |
| 61 | # Build python bindings for libmount |
| 62 | PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python" |
| 63 | |
| 64 | FILES_${PN}-bash-completion += "${datadir}/bash-completion" |
| 65 | FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" |
| 66 | |
| 67 | FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.la" |
| 68 | FILES_${PN}-dbg += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/.debug/" |
| 69 | |
| 70 | FILES_util-linux-agetty = "${base_sbindir}/agetty" |
| 71 | FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}" |
| 72 | FILES_util-linux-fstrim = "${base_sbindir}/fstrim" |
| 73 | FILES_util-linux-cfdisk = "${base_sbindir}/cfdisk" |
| 74 | FILES_util-linux-sfdisk = "${sbindir}/sfdisk" |
| 75 | FILES_util-linux-swaponoff = "${base_sbindir}/swapon.${BPN} ${base_sbindir}/swapoff.${BPN}" |
| 76 | FILES_util-linux-losetup = "${base_sbindir}/losetup.${BPN}" |
| 77 | FILES_util-linux-mount = "${base_bindir}/mount.${BPN}" |
| 78 | FILES_util-linux-mcookie = "${bindir}/mcookie" |
| 79 | FILES_util-linux-umount = "${base_bindir}/umount.${BPN}" |
| 80 | FILES_util-linux-readprofile = "${sbindir}/readprofile.${BPN}" |
| 81 | FILES_util-linux-uuidgen = "${bindir}/uuidgen" |
| 82 | FILES_util-linux-uuidd = "${sbindir}/uuidd" |
| 83 | FILES_util-linux-reset = "${base_bindir}/reset" |
| 84 | FILES_util-linux-partx = "${sbindir}/partx" |
| 85 | FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}" |
| 86 | FILES_util-linux-findfs = "${sbindir}/findfs" |
| 87 | FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}" |
| 88 | |
| 89 | FILES_util-linux-pylibmount = "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.so \ |
| 90 | ${libdir}/${PYTHON_DIR}/dist-packages/libmount/__init__.*" |
| 91 | FILES_util-linux-lscpu = "${bindir}/lscpu" |
| 92 | |
| 93 | FILES_util-linux-fsck = "${base_sbindir}/fsck*" |
| 94 | FILES_util-linux-mkfs = "${sbindir}/mkfs" |
| 95 | |
| 96 | FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs" |
| 97 | FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs" |
| 98 | |
| 99 | FILES_util-linux-sulogin = "${base_sbindir}/sulogin*" |
| 100 | |
| 101 | # Util-linux' blkid replaces the e2fsprogs one |
| 102 | FILES_util-linux-blkid = "${base_sbindir}/blkid*" |
| 103 | RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid" |
| 104 | RREPLACES_util-linux-blkid = "e2fsprogs-blkid" |
| 105 | |
| 106 | # reset calls 'tput' |
| 107 | RDEPENDS_util-linux-reset += "ncurses" |
| 108 | |
| 109 | RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin" |
| 110 | RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs " |
| 111 | |
| 112 | RRECOMMENDS_${PN}_class-native = "" |
| 113 | RRECOMMENDS_${PN}_class-nativesdk = "" |
| 114 | RDEPENDS_${PN}_class-native = "" |
| 115 | RDEPENDS_${PN}_class-nativesdk = "" |
| 116 | |
| 117 | RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev" |
| 118 | |
| 119 | #SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" |
| 120 | SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" |
| 121 | SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" |
| 122 | SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" |
| 123 | SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" |
| 124 | |
| 125 | do_compile () { |
| 126 | set -e |
| 127 | oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}' |
| 128 | } |
| 129 | |
| 130 | do_install () { |
| 131 | # with ccache the timestamps on compiled files may |
| 132 | # end up earlier than on their inputs, this allows |
| 133 | # for the resultant compilation in the install step. |
| 134 | oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \ |
| 135 | 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \ |
| 136 | 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install |
| 137 | |
| 138 | mkdir -p ${D}${base_bindir} |
| 139 | |
| 140 | sbinprogs="agetty ctrlaltdel cfdisk vipw vigr" |
| 141 | sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root" |
| 142 | binprogs_a="dmesg getopt kill more umount mount login reset su" |
| 143 | |
| 144 | if [ "${base_sbindir}" != "${sbindir}" ]; then |
| 145 | mkdir -p ${D}${base_sbindir} |
| 146 | for p in $sbinprogs $sbinprogs_a; do |
| 147 | if [ -f "${D}${sbindir}/$p" ]; then |
| 148 | mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p" |
| 149 | fi |
| 150 | done |
| 151 | fi |
| 152 | |
| 153 | if [ "${base_bindir}" != "${bindir}" ]; then |
| 154 | mkdir -p ${D}${base_bindir} |
| 155 | for p in $binprogs_a; do |
| 156 | if [ -f "${D}${bindir}/$p" ]; then |
| 157 | mv "${D}${bindir}/$p" "${D}${base_bindir}/$p" |
| 158 | fi |
| 159 | done |
| 160 | fi |
| 161 | |
| 162 | install -d ${D}${sysconfdir}/default/ |
| 163 | echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall |
| 164 | |
| 165 | rm -f ${D}${bindir}/chkdupexe |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 166 | |
| 167 | if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then |
| 168 | install -d ${D}${sysconfdir}/pam.d |
| 169 | install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser |
| 170 | install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l |
| 171 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | # reset and nologin causes a conflict with ncurses-native and shadow-native |
| 175 | do_install_append_class-native () { |
| 176 | rm -f ${D}${base_bindir}/reset |
| 177 | rm -f ${D}${base_sbindir}/nologin |
| 178 | } |
| 179 | |
| 180 | ALTERNATIVE_PRIORITY = "100" |
| 181 | |
| 182 | ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root" |
| 183 | ALTERNATIVE_${PN} += "mkfs.minix hexdump last lastb logger mesg renice wall" |
| 184 | ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject" |
| 185 | |
| 186 | ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" |
| 187 | ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" |
| 188 | ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more" |
| 189 | ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap" |
| 190 | ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" |
| 191 | ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root" |
| 192 | ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root" |
| 193 | ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix" |
| 194 | ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" |
| 195 | |
| 196 | ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 reset.1 kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3" |
| 197 | |
| 198 | ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1" |
| 199 | ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1" |
| 200 | ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1" |
| 201 | ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1" |
| 202 | ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8" |
| 203 | ALTERNATIVE_LINK_NAME[reset.1] = "${mandir}/man1/reset.1" |
| 204 | ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8" |
| 205 | ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1" |
| 206 | ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1" |
| 207 | ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" |
| 208 | ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3" |
| 209 | ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8" |
| 210 | ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8" |
| 211 | ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8" |
| 212 | ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3" |
| 213 | |
| 214 | ALTERNATIVE_util-linux-hwclock = "hwclock" |
| 215 | # There seems to be problem, atleast on nslu2, with these, untill they are |
| 216 | # fixed the busybox ones have higher priority |
| 217 | ALTERNATIVE_PRIORITY[hwclock] = "10" |
| 218 | ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" |
| 219 | |
| 220 | ALTERNATIVE_util-linux-fdisk = "fdisk" |
| 221 | ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" |
| 222 | |
| 223 | ALTERNATIVE_util-linux-agetty = "getty" |
| 224 | ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" |
| 225 | ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" |
| 226 | |
| 227 | ALTERNATIVE_util-linux-mount = "mount" |
| 228 | ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount" |
| 229 | |
| 230 | ALTERNATIVE_util-linux-umount = "umount" |
| 231 | ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount" |
| 232 | |
| 233 | ALTERNATIVE_util-linux-readprofile = "readprofile" |
| 234 | ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile" |
| 235 | |
| 236 | ALTERNATIVE_util-linux-losetup = "losetup" |
| 237 | ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup" |
| 238 | |
| 239 | ALTERNATIVE_util-linux-swaponoff = "swapoff swapon" |
| 240 | ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff" |
| 241 | ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon" |
| 242 | |
| 243 | ALTERNATIVE_util-linux-fsck = "fsck.minix fsck" |
| 244 | ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix" |
| 245 | ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" |
| 246 | |
| 247 | ALTERNATIVE_util-linux-blkid = "blkid" |
| 248 | ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" |
| 249 | |
| 250 | ALTERNATIVE_util-linux-reset = "reset" |
| 251 | ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset" |
| 252 | ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset" |
| 253 | |
| 254 | ALTERNATIVE_util-linux-getopt = "getopt" |
| 255 | ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" |
| 256 | |
| 257 | ALTERNATIVE_util-linux-sulogin = "sulogin" |
| 258 | ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin" |
| 259 | |
| 260 | BBCLASSEXTEND = "native nativesdk" |
| 261 | |
| 262 | python do_package_prepend () { |
| 263 | if '--enable-su' in d.getVar('EXTRA_OECONF', True).split(): |
| 264 | alt_name = "su" |
| 265 | d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name)) |
| 266 | d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name) |
| 267 | } |
| 268 | |
| 269 | python populate_packages_prepend() { |
| 270 | do_split_packages(d, '${base_libdir}', '^lib(.*)\.so\..*$', |
| 271 | output_pattern='util-linux-lib%s', |
| 272 | description='util-linux lib%s', |
| 273 | extra_depends='', prepend=True, allow_links=True) |
| 274 | } |