summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux/util-linux.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux/util-linux.inc')
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc270
1 files changed, 270 insertions, 0 deletions
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
new file mode 100644
index 0000000..b67620b
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -0,0 +1,270 @@
1SUMMARY = "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
20inherit autotools gettext pkgconfig systemd ptest
21DEPENDS = "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 file://MCONFIG \
27 file://defines.h \
28 file://make_include \
29 file://swapargs.h \
30 file://ptest.patch \
31 file://run-ptest \
32 file://avoid_unsupported_find_opts.patch \
33 file://avoid_unsupported_grep_opts.patch \
34 file://avoid_unsupported_sleep_param.patch \
35 file://display_testname_for_subtest.patch \
36 "
37
38PACKAGES =+ "util-linux-agetty util-linux-fdisk util-linux-cfdisk util-linux-sfdisk \
39 util-linux-swaponoff util-linux-losetup util-linux-umount \
40 util-linux-mount util-linux-readprofile util-linux-libblkid \
41 util-linux-libmount util-linux-libuuid util-linux-uuidd \
42 util-linux-uuidgen util-linux-lscpu util-linux-fsck util-linux-blkid \
43 util-linux-mkfs util-linux-mcookie util-linux-reset \
44 util-linux-mkfs.cramfs util-linux-fsck.cramfs util-linux-fstrim \
45 util-linux-partx ${PN}-bash-completion"
46
47SHARED_EXTRA_OECONF = "--disable-use-tty-group \
48 --disable-makeinstall-chown \
49 --enable-kill --enable-last --enable-mesg --enable-partx \
50 --enable-raw --enable-reset --disable-login \
51 --disable-vipw --disable-newgrp --disable-chfn-chsh \
52 --enable-write --enable-mount \
53 --enable-libuuid --enable-libblkid --enable-fsck --without-udev \
54 usrsbin_execdir='${sbindir}' \
55"
56
57EXTRA_OECONF = "${SHARED_EXTRA_OECONF} --libdir=${base_libdir}"
58
59PACKAGECONFIG_class-target ?= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \
60 ${@base_contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} "
61PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
62
63# Respect the systemd feature for uuidd
64PACKAGECONFIG[systemd] = "--enable-socket-activation --with-systemdsystemunitdir=${systemd_unitdir}/system/, --disable-socket-activation --without-systemdsystemunitdir"
65
66# Build setpriv requires libcap-ng
67PACKAGECONFIG[libcap-ng] = "--enable-setpriv,--disable-setpriv,libcap-ng,"
68
69FILES_${PN}-bash-completion += "${datadir}/bash-completion"
70FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
71
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 = "${base_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"
87
88FILES_util-linux-libblkid = "${base_libdir}/libblkid.so.*"
89FILES_util-linux-libmount = "${base_libdir}/libmount.so.*"
90FILES_util-linux-libuuid = "${base_libdir}/libuuid.so.*"
91FILES_util-linux-lscpu = "${bindir}/lscpu"
92
93FILES_util-linux-fsck = "${base_sbindir}/fsck*"
94FILES_util-linux-mkfs = "${sbindir}/mkfs"
95
96FILES_util-linux-fsck.cramfs = "${sbindir}/fsck.cramfs"
97FILES_util-linux-mkfs.cramfs = "${sbindir}/mkfs.cramfs"
98
99
100# Util-linux' blkid replaces the e2fsprogs one
101FILES_util-linux-blkid = "${base_sbindir}/blkid*"
102RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
103RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
104
105# reset calls 'tput'
106RDEPENDS_util-linux-reset += "ncurses"
107
108RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup"
109RRECOMMENDS_${PN} = "util-linux-fdisk util-linux-cfdisk util-linux-sfdisk util-linux-mount util-linux-readprofile util-linux-mkfs "
110
111RRECOMMENDS_${PN}_class-native = ""
112RRECOMMENDS_${PN}_class-nativesdk = ""
113RDEPENDS_${PN}_class-native = ""
114RDEPENDS_${PN}_class-nativesdk = ""
115
116RPROVIDES_${PN}-dev = "util-linux-libblkid-dev util-linux-libmount-dev util-linux-libuuid-dev"
117
118SYSTEMD_PACKAGES = "${PN}-uuidd"
119SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.service"
120
121do_compile () {
122 set -e
123 install ${WORKDIR}/MCONFIG ${S}/MCONFIG
124 install ${WORKDIR}/make_include ${S}/make_include
125 install ${WORKDIR}/swapargs.h ${S}/mount-deprecated/swapargs.h
126 install ${WORKDIR}/defines.h ${S}/defines.h
127 oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'
128}
129
130do_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 readprofile fsck blkid blockdev fstrim"
142 usrbinprogs_a="chfn chsh hexdump last logger mesg newgrp renice utmpdump wall setsid chrt flock getopt"
143 binprogs_a="dmesg kill more umount mount login reset su"
144
145 if [ "${base_sbindir}" != "${sbindir}" ]; then
146 mkdir -p ${D}${base_sbindir}
147 for p in $sbinprogs $sbinprogs_a; do
148 if [ -f "${D}${sbindir}/$p" ]; then
149 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
150 fi
151 done
152 fi
153
154 if [ "${base_bindir}" != "${bindir}" ]; then
155 mkdir -p ${D}${base_bindir}
156 for p in $binprogs_a; do
157 if [ -f "${D}${bindir}/$p" ]; then
158 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
159 fi
160 done
161 fi
162
163 install -d ${D}${sysconfdir}/default/
164 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
165
166 rm -f ${D}${bindir}/chkdupexe
167}
168
169inherit update-alternatives
170
171ALTERNATIVE_PRIORITY = "100"
172
173ALTERNATIVE_${PN} = "dmesg kill more mkswap blockdev pivot_root"
174ALTERNATIVE_${PN} += "mkfs.minix hexdump last logger mesg renice wall"
175ALTERNATIVE_${PN} += "setsid chrt flock hwclock utmpdump eject getopt"
176
177ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
178ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
179ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
180ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
181ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
182ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
183ALTERNATIVE_LINK_NAME[mkfs.minix] = "${base_sbindir}/mkfs.minix"
184ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
185ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
186ALTERNATIVE_TARGET[getopt] = "${bindir}/getopt"
187
188ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 mesg.1 wall.1 sulogin.8 utmpdump.1 reset.1"
189
190ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
191ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
192ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
193ALTERNATIVE_LINK_NAME[reset.1] = "${mandir}/man1/reset.1"
194ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
195ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
196ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
197
198# There seems to be problem, atleast on nslu2, with these, untill they are
199# fixed the busybox ones have higher priority
200ALTERNATIVE_PRIORITY[hwclock] = "10"
201ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
202
203ALTERNATIVE_util-linux-fdisk = "fdisk"
204ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
205
206ALTERNATIVE_util-linux-agetty = "getty"
207ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
208ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
209
210ALTERNATIVE_util-linux-mount = "mount"
211ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
212
213ALTERNATIVE_util-linux-umount = "umount"
214ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
215
216ALTERNATIVE_util-linux-readprofile = "readprofile"
217ALTERNATIVE_LINK_NAME[readprofile] = "${base_sbindir}/readprofile"
218
219ALTERNATIVE_util-linux-losetup = "losetup"
220ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
221
222ALTERNATIVE_util-linux-swaponoff = "swapoff swapon"
223ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
224ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
225
226ALTERNATIVE_util-linux-fsck = "fsck.minix fsck"
227ALTERNATIVE_LINK_NAME[fsck.minix] = "${base_sbindir}/fsck.minix"
228ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
229
230ALTERNATIVE_util-linux-blkid = "blkid"
231ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
232
233ALTERNATIVE_util-linux-reset = "reset"
234ALTERNATIVE_LINK_NAME[reset] = "${bindir}/reset"
235ALTERNATIVE_TARGET[reset] = "${base_bindir}/reset"
236
237BBCLASSEXTEND = "native nativesdk"
238
239python do_package_prepend () {
240 if '--enable-su' in d.getVar('EXTRA_OECONF', True).split():
241 alt_name = "su"
242 d.setVarFlag('ALTERNATIVE_LINK_NAME', alt_name, '%s/%s' % (d.getVar('base_bindir', True), alt_name))
243 d.appendVar('ALTERNATIVE_%s' % (d.getVar('PN', True)), ' ' + alt_name)
244}
245
246do_compile_ptest() {
247 oe_runmake buildtest-TESTS
248}
249
250do_install_ptest() {
251 mkdir -p ${D}${PTEST_PATH}/tests/ts
252 find . -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
253 cp ${S}/tests/functions.sh ${D}${PTEST_PATH}/tests/
254 cp ${S}/tests/commands.sh ${D}${PTEST_PATH}/tests/
255 cp ${S}/tests/run.sh ${D}${PTEST_PATH}/tests/
256 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
257
258 list="bitops build-sys cal col colrm column dmesg fsck hexdump hwclock ipcs isosize login look lscpu md5 misc more namei paths schedutils script swapon tailf utmpdump"
259 # The following tests are not installed yet:
260 # blkid scsi_debug module dependent
261 # cramfs gcc dependent
262 # eject gcc dependent
263 # fdisk scsi_debug module and gcc dependent
264 # libmount uuidgen dependent
265 # mount gcc dependant
266 # partx blkid dependant
267 for d in $list; do
268 cp -pR ${S}/tests/ts/$d ${D}${PTEST_PATH}/tests/ts/
269 done
270}