blob: a1614c22fafc2bb0461fa2bfe6f6b19557c3a66f [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "A suite of basic system administration utilities"
2DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
3commonly found on most Linux systems. Some of the more important utilities include \
4disk partitioning, kernel message management, filesystem creation, and system login."
5
6SECTION = "base"
7
8LICENSE = "GPLv2+ & LGPLv2.1+ & BSD"
9
10LIC_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
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050020inherit autotools gettext pkgconfig systemd update-alternatives python-dir ptest bash-completion
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021DEPENDS = "zlib ncurses"
22DEPENDS_append_class-native = " lzo-native"
23DEPENDS_append_class-nativesdk = " lzo-native"
24
25SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
26 "
27
28PACKAGES =+ "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 \
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050034 util-linux-partx util-linux-hwclock util-linux-mountpoint \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050035 util-linux-findfs util-linux-getopt util-linux-sulogin"
36PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', 'util-linux-pylibmount', '', d)}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050037PACKAGES =+ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050038
39PACKAGES_DYNAMIC = "^util-linux-lib.*"
40
41SHARED_EXTRA_OECONF = "--disable-use-tty-group \
42 --disable-makeinstall-chown \
43 --enable-kill --enable-last --enable-mesg --enable-partx \
44 --enable-raw --enable-reset --disable-login \
45 --disable-vipw --disable-newgrp --disable-chfn-chsh \
46 --enable-write --enable-mount \
47 --enable-libuuid --enable-libblkid --enable-fsck --without-udev \
48 usrsbin_execdir='${sbindir}' \
49"
50
51EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
52
53PACKAGECONFIG_class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
54PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
55
56# Respect the systemd feature for uuidd
57PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_unitdir}/system/, --without-systemd --without-systemdsystemunitdir,systemd"
58
59# Build setpriv requires libcap-ng
60PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
61
62# Build python bindings for libmount
63PACKAGECONFIG[pylibmount] = "--with-python --enable-pylibmount,--without-python --disable-pylibmount,python"
64
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050065# Readline support
66PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
67
Patrick Williamsc124f4f2015-09-15 14:41:29 -050068FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
69
70FILES_${PN}-dev += "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.la"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
72FILES_util-linux-agetty = "${base_sbindir}/agetty"
73FILES_util-linux-fdisk = "${base_sbindir}/fdisk.${BPN}"
74FILES_util-linux-fstrim = "${base_sbindir}/fstrim"
75FILES_util-linux-cfdisk = "${base_sbindir}/cfdisk"
76FILES_util-linux-sfdisk = "${sbindir}/sfdisk"
77FILES_util-linux-swaponoff = "${base_sbindir}/swapon.${BPN} ${base_sbindir}/swapoff.${BPN}"
78FILES_util-linux-losetup = "${base_sbindir}/losetup.${BPN}"
79FILES_util-linux-mount = "${base_bindir}/mount.${BPN}"
80FILES_util-linux-mcookie = "${bindir}/mcookie"
81FILES_util-linux-umount = "${base_bindir}/umount.${BPN}"
82FILES_util-linux-readprofile = "${sbindir}/readprofile.${BPN}"
83FILES_util-linux-uuidgen = "${bindir}/uuidgen"
84FILES_util-linux-uuidd = "${sbindir}/uuidd"
85FILES_util-linux-reset = "${base_bindir}/reset"
86FILES_util-linux-partx = "${sbindir}/partx"
87FILES_util-linux-hwclock = "${base_sbindir}/hwclock.${BPN}"
88FILES_util-linux-findfs = "${sbindir}/findfs"
89FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050090FILES_util-linux-runuser = "${sbindir}/runuser"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091
92FILES_util-linux-pylibmount = "${libdir}/${PYTHON_DIR}/dist-packages/libmount/pylibmount.so \
93 ${libdir}/${PYTHON_DIR}/dist-packages/libmount/__init__.*"
94FILES_util-linux-lscpu = "${bindir}/lscpu"
95
96FILES_util-linux-fsck = "${base_sbindir}/fsck*"
97FILES_util-linux-mkfs = "${sbindir}/mkfs"
98
99FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs"
100FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
101
102FILES_util-linux-sulogin = "${base_sbindir}/sulogin*"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500103FILES_util-linux-mountpoint = "${base_bindir}/mountpoint.${BPN}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500104
105# Util-linux' blkid replaces the e2fsprogs one
106FILES_util-linux-blkid = "${base_sbindir}/blkid*"
107RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
108RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
109
110# reset calls 'tput'
111RDEPENDS_util-linux-reset += "ncurses"
112
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500113RDEPENDS_util-linux-runuser += "libpam"
114
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500116RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser', '', d)}"
117
118RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs util-linux-mountpoint"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119
120RRECOMMENDS_${PN}_class-native = ""
121RRECOMMENDS_${PN}_class-nativesdk = ""
122RDEPENDS_${PN}_class-native = ""
123RDEPENDS_${PN}_class-nativesdk = ""
124
125RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev"
126
127#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
128SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service"
129SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable"
130SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service"
131SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable"
132
133do_compile () {
134 set -e
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500135 oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136}
137
138do_install () {
139 # with ccache the timestamps on compiled files may
140 # end up earlier than on their inputs, this allows
141 # for the resultant compilation in the install step.
142 oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \
143 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \
144 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
145
146 mkdir -p ${D}${base_bindir}
147
148 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
149 sbinprogs_a="pivot_root hwclock mkswap mkfs.minix fsck.minix losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500150 binprogs_a="dmesg getopt kill more umount mount login reset su mountpoint"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151
152 if [ "${base_sbindir}" != "${sbindir}" ]; then
153 mkdir -p ${D}${base_sbindir}
154 for p in $sbinprogs $sbinprogs_a; do
155 if [ -f "${D}${sbindir}/$p" ]; then
156 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
157 fi
158 done
159 fi
160
161 if [ "${base_bindir}" != "${bindir}" ]; then
162 mkdir -p ${D}${base_bindir}
163 for p in $binprogs_a; do
164 if [ -f "${D}${bindir}/$p" ]; then
165 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
166 fi
167 done
168 fi
169
170 install -d ${D}${sysconfdir}/default/
171 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
172
173 rm -f ${D}${bindir}/chkdupexe
Patrick Williamsf1e5d692016-03-30 15:21:19 -0500174
175 if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then
176 install -d ${D}${sysconfdir}/pam.d
177 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
178 install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
179 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500180}
181
182# reset and nologin causes a conflict with ncurses-native and shadow-native
183do_install_append_class-native () {
184 rm -f ${D}${base_bindir}/reset
185 rm -f ${D}${base_sbindir}/nologin
186}
187
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500188ALTERNATIVE_PRIORITY = "80"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500189
190ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root switch_root"
191ALTERNATIVE_${PN} += "mkfs.minix hexdump last lastb logger mesg renice wall"
192ALTERNATIVE_${PN} += "setsid chrt flock utmpdump eject"
193
194ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
195ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
196ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
197ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
198ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
199ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
200ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
201ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
202ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
203
204ALTERNATIVE_${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"
205
206ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
207ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
208ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
209ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
210ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
211ALTERNATIVE_LINK_NAME[reset.1] = "${mandir}/man1/reset.1"
212ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
213ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
214ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
215ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
216ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
217ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
218ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
219ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
220ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
221
222ALTERNATIVE_util-linux-hwclock = "hwclock"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500223ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
224
225ALTERNATIVE_util-linux-fdisk = "fdisk"
226ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
227
228ALTERNATIVE_util-linux-agetty = "getty"
229ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
230ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
231
232ALTERNATIVE_util-linux-mount = "mount"
233ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
234
235ALTERNATIVE_util-linux-umount = "umount"
236ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
237
238ALTERNATIVE_util-linux-readprofile = "readprofile"
239ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
240
241ALTERNATIVE_util-linux-losetup = "losetup"
242ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
243
244ALTERNATIVE_util-linux-swaponoff = "swapoff swapon"
245ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
246ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
247
248ALTERNATIVE_util-linux-fsck = "fsck.minix fsck"
249ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix"
250ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
251
252ALTERNATIVE_util-linux-blkid = "blkid"
253ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
254
255ALTERNATIVE_util-linux-reset = "reset"
256ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
257ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
258
259ALTERNATIVE_util-linux-getopt = "getopt"
260ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
261
262ALTERNATIVE_util-linux-sulogin = "sulogin"
263ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
264
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500265ALTERNATIVE_util-linux-mountpoint = "mountpoint"
266ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
267
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500268BBCLASSEXTEND = "native nativesdk"
269
270python do_package_prepend () {
271 if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
272 alt_name = "su"
273 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
274 d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
275}
276
277python populate_packages_prepend() {
278 do_split_packages(d, '${base_libdir}', '^lib(.*)\.so\..*$',
279 output_pattern='util-linux-lib%s',
280 description='util-linux lib%s',
281 extra_depends='', prepend=True, allow_links=True)
282}
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500283
284RDEPENDS_${PN}-ptest = "bash"
285
286do_compile_ptest() {
287 oe_runmake buildtest-TESTS
288}
289
290do_install_ptest() {
291 mkdir -p ${D}${PTEST_PATH}/tests/ts
292 find . -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
293 cp ${S}/tests/functions.sh ${D}${PTEST_PATH}/tests/
294 cp ${S}/tests/commands.sh ${D}${PTEST_PATH}/tests/
295 cp ${S}/tests/run.sh ${D}${PTEST_PATH}/tests/
296 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
297
298 list="bitops build-sys cal col colrm column dmesg fsck hexdump hwclock ipcs isosize login look md5 misc more namei paths schedutils script swapon tailf"
299 # The following tests are not installed yet:
300 # blkid scsi_debug module dependent
301 # cramfs gcc dependent
302 # eject gcc dependent
303 # fdisk scsi_debug module and gcc dependent
304 # lscpu gcc dependant
305 # libmount uuidgen dependent
306 # mount gcc dependant
307 # partx blkid dependant
308 for d in $list; do
309 cp -pR ${S}/tests/ts/$d ${D}${PTEST_PATH}/tests/ts/
310 done
311}