diff options
Diffstat (limited to 'recipes-core/util-linux-ng/util-linux-ng.inc')
| -rw-r--r-- | recipes-core/util-linux-ng/util-linux-ng.inc | 321 |
1 files changed, 321 insertions, 0 deletions
diff --git a/recipes-core/util-linux-ng/util-linux-ng.inc b/recipes-core/util-linux-ng/util-linux-ng.inc new file mode 100644 index 0000000000..7455098009 --- /dev/null +++ b/recipes-core/util-linux-ng/util-linux-ng.inc | |||
| @@ -0,0 +1,321 @@ | |||
| 1 | DESCRIPTION = "Util-linux-ng is a suite of essential utilities for any Linux system." | ||
| 2 | SECTION = "base" | ||
| 3 | LICENSE = "GPL" | ||
| 4 | DEPENDS = "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)} udev zlib ncurses virtual/libintl" | ||
| 5 | DEPENDS_virtclass-native = "zlib-native ncurses-native lzo-native gettext-native" | ||
| 6 | |||
| 7 | inherit autotools gettext | ||
| 8 | |||
| 9 | INC_PR = "r33" | ||
| 10 | |||
| 11 | # allows for a release candidate | ||
| 12 | RC ?= "" | ||
| 13 | |||
| 14 | SRC_URI = "${KERNELORG_MIRROR}/pub/linux/utils/util-linux-ng/v${PV}/util-linux-ng-${PV}${RC}.tar.bz2;name=archive" | ||
| 15 | |||
| 16 | SRC_URI_append_chinook-compat = " file://chinook_libtool.patch " | ||
| 17 | |||
| 18 | PACKAGES =+ "${PN}-fdisk ${PN}-cfdisk ${PN}-sfdisk ${PN}-swaponoff \ | ||
| 19 | ${PN}-losetup ${PN}-umount ${PN}-mount ${PN}-readprofile \ | ||
| 20 | ${PN}-fsck ${PN}-blkid ${PN}-mountall ${PN}-reset" | ||
| 21 | |||
| 22 | PACKAGES_virtclass-native = "" | ||
| 23 | |||
| 24 | PACKAGES_DYNAMIC = "libblkid* libuuid*" | ||
| 25 | |||
| 26 | # Provide old util-linux names (several recipes still use DEPENDS or RDEPENDS_${PN} = "util-linux"): | ||
| 27 | PROVIDES = "util-linux" | ||
| 28 | RPROVIDES_${PN} = "util-linux" | ||
| 29 | RPROVIDES_util-linux-ng-fdisk = "util-linux-fdisk" | ||
| 30 | RPROVIDES_util-linux-ng-cfdisk = "util-linux-cfdisk" | ||
| 31 | RPROVIDES_util-linux-ng-sfdisk = "util-linux-sfdisk" | ||
| 32 | RPROVIDES_util-linux-ng-swaponoff = "util-linux-swaponoff" | ||
| 33 | RPROVIDES_util-linux-ng-losetup = "util-linux-losetup" | ||
| 34 | RPROVIDES_util-linux-ng-umount = "util-linux-umount" | ||
| 35 | RPROVIDES_util-linux-ng-mount = "util-linux-mount" | ||
| 36 | RPROVIDES_util-linux-ng-readprofile = "util-linux-readprofile" | ||
| 37 | RPROVIDES_util-linux-ng-fsck = "e2fsprogs-fsck" | ||
| 38 | RPROVIDES_util-linux-ng-blkid = "e2fsprogs-blkid" | ||
| 39 | |||
| 40 | FILES_${PN}-doc += "/usr/share/misc/getopt/getopt-*.*" | ||
| 41 | FILES_${PN} = "${bindir} ${sbindir} ${base_bindir} ${base_sbindir}" | ||
| 42 | |||
| 43 | FILES_util-linux-ng-fdisk = "${base_sbindir}/fdisk.${PN}" | ||
| 44 | FILES_util-linux-ng-cfdisk = "${base_sbindir}/cfdisk" | ||
| 45 | # Moved to ${sbindir} in new versions: | ||
| 46 | FILES_util-linux-ng-sfdisk = "${base_sbindir}/sfdisk ${sbindir}/sfdisk" | ||
| 47 | FILES_util-linux-ng-swaponoff = "${base_sbindir}/swapon.${PN} ${base_sbindir}/swapoff.${PN}" | ||
| 48 | FILES_util-linux-ng-losetup = "${base_sbindir}/losetup.${PN}" | ||
| 49 | FILES_util-linux-ng-mount = "${base_bindir}/mount.${PN} ${sysconfdir}/default/mountall" | ||
| 50 | FILES_util-linux-ng-umount = "${base_bindir}/umount.${PN}" | ||
| 51 | # Moved to ${base_sbindir} by do_install: | ||
| 52 | FILES_util-linux-ng-readprofile = "${sbindir}/readprofile.${PN}" | ||
| 53 | FILES_util-linux-ng-fsck = "${base_sbindir}/fsck.${PN}" | ||
| 54 | FILES_util-linux-ng-blkid = "${base_sbindir}/blkid.${PN}" | ||
| 55 | FILES_${PN}-mountall = "${sysconfdir}/default/mountall.${PN}" | ||
| 56 | FILES_${PN}-reset = "${bindir}/reset.${PN}" | ||
| 57 | |||
| 58 | RREPLACES_util-linux-ng-blkid = "e2fsprogs-blkid" | ||
| 59 | RREPLACES_${PN}-mountall = "busybox-mountall" | ||
| 60 | |||
| 61 | RRECOMMENDS_${PN} = "${PN}-fdisk ${PN}-cfdisk ${PN}-sfdisk ${PN}-mount ${PN}-readprofile" | ||
| 62 | RDEPENDS_${PN} = "${PN}-mountall ${PN}-umount ${PN}-swaponoff ${PN}-losetup ${PN}-fsck ${PN}-blkid" | ||
| 63 | RDEPENDS_${PN}-reset = "ncurses-tools" | ||
| 64 | |||
| 65 | RRECOMMENDS_${PN}_virtclass-native = "" | ||
| 66 | RDEPENDS_${PN}_virtclass-native = "" | ||
| 67 | |||
| 68 | EXTRA_OECONF = "--disable-use-tty-group --disable-makeinstall-chown \ | ||
| 69 | --enable-kill --enable-last --enable-mesg --enable-raw --enable-login-utils \ | ||
| 70 | --enable-arch --enable-init --enable-partx --enable-schedutils \ | ||
| 71 | --with-fsprobe=builtin --enable-libuuid --enable-libblkid \ | ||
| 72 | --enable-fsck --enable-reset" | ||
| 73 | |||
| 74 | LDFLAGS_append_libc-uclibc = "${@['',' -lintl'][bb.data.getVar('USE_NLS', d, 1) == 'yes']}" | ||
| 75 | LDFLAGS_virtclass-native = "${BUILD_LDFLAGS}" | ||
| 76 | |||
| 77 | S = "${WORKDIR}/util-linux-ng-${PV}${RC}" | ||
| 78 | |||
| 79 | do_configure_prepend_chinook-compat () { | ||
| 80 | |||
| 81 | for i in lt~obsolete.m4 ltsugar.m4 libtool.m4 ltoptions.m4 ltversion.m4 | ||
| 82 | do | ||
| 83 | rm ${S}/m4/${i} | ||
| 84 | done | ||
| 85 | } | ||
| 86 | |||
| 87 | do_compile () { | ||
| 88 | set -e | ||
| 89 | oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \ | ||
| 90 | 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \ | ||
| 91 | 'LDFLAGS=${LDFLAGS}' | ||
| 92 | } | ||
| 93 | |||
| 94 | checklink() { | ||
| 95 | local targ link value | ||
| 96 | targ="$1" | ||
| 97 | link="$2" | ||
| 98 | ext="$3" | ||
| 99 | if test -h "$link" | ||
| 100 | then | ||
| 101 | value="$(readlink "$link")" | ||
| 102 | if test "$value" = "$targ" | ||
| 103 | then | ||
| 104 | rm "$link" | ||
| 105 | ln -s "$targ"."${PN}" "$link$ext" | ||
| 106 | return 0 | ||
| 107 | else | ||
| 108 | echo "$link: '$value' found '$targ' expected" >&2 | ||
| 109 | return 1 | ||
| 110 | fi | ||
| 111 | else | ||
| 112 | echo "$link: not a symbolic link" >&2 | ||
| 113 | return 1 | ||
| 114 | fi | ||
| 115 | } | ||
| 116 | |||
| 117 | do_install () { | ||
| 118 | # with ccache the timestamps on compiled files may | ||
| 119 | # end up earlier than on their inputs, this allows | ||
| 120 | # for the resultant compilation in the install step. | ||
| 121 | oe_runmake ARCH=${TARGET_ARCH} CPU= CPUOPT= \ | ||
| 122 | 'OPT=${CFLAGS}' 'CC=${CC}' 'LD=${LD}' \ | ||
| 123 | 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install | ||
| 124 | mkdir -p ${D}${base_bindir} | ||
| 125 | |||
| 126 | sbinprogs="agetty blockdev ctrlaltdel cfdisk" | ||
| 127 | sbinprogs_a="pivot_root hwclock mkswap shutdown mkfs.minix fsck.minix losetup swapon fdisk fsck blkid vigr vipw" | ||
| 128 | usrbinprogs_a="chfn chsh hexdump last logger mesg newgrp renice wall setsid chrt reset cal script flock" | ||
| 129 | usrsbinprogs_a="readprofile" | ||
| 130 | binprogs_a="dmesg kill more umount mount login" | ||
| 131 | |||
| 132 | if [ "${base_sbindir}" != "${sbindir}" ]; then | ||
| 133 | mkdir -p ${D}${base_sbindir} | ||
| 134 | for p in $sbinprogs $sbinprogs_a; do | ||
| 135 | if [ -f "${D}${sbindir}/$p" ]; then | ||
| 136 | mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p" | ||
| 137 | fi | ||
| 138 | done | ||
| 139 | fi | ||
| 140 | |||
| 141 | if [ "${base_bindir}" != "${bindir}" ]; then | ||
| 142 | mkdir -p ${D}${base_bindir} | ||
| 143 | for p in $binprogs_a; do | ||
| 144 | if [ -f "${D}${bindir}/$p" ]; then | ||
| 145 | mv "${D}${bindir}/$p" "${D}${base_bindir}/$p" | ||
| 146 | fi | ||
| 147 | done | ||
| 148 | fi | ||
| 149 | |||
| 150 | for p in $usrbinprogs_a; do | ||
| 151 | if [ -f "${D}${bindir}/$p" ]; then | ||
| 152 | mv "${D}${bindir}/$p" "${D}${bindir}/$p.${PN}" | ||
| 153 | fi | ||
| 154 | done | ||
| 155 | |||
| 156 | for p in $usrsbinprogs_a; do | ||
| 157 | if [ -f "${D}${sbindir}/$p" ]; then | ||
| 158 | mv "${D}${sbindir}/$p" "${D}${sbindir}/$p.${PN}" | ||
| 159 | fi | ||
| 160 | done | ||
| 161 | |||
| 162 | for p in $binprogs_a; do | ||
| 163 | if [ -f "${D}${base_bindir}/$p" ]; then | ||
| 164 | mv "${D}${base_bindir}/$p" "${D}${base_bindir}/$p.${PN}" | ||
| 165 | fi | ||
| 166 | done | ||
| 167 | |||
| 168 | for p in $sbinprogs_a; do | ||
| 169 | if [ -f "${D}${base_sbindir}/$p" ]; then | ||
| 170 | mv "${D}${base_sbindir}/$p" "${D}${base_sbindir}/$p.${PN}" | ||
| 171 | fi | ||
| 172 | done | ||
| 173 | |||
| 174 | install -d ${D}${sysconfdir}/default/ | ||
| 175 | echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall.${PN} | ||
| 176 | |||
| 177 | rm ${D}${sbindir}/swapoff -f | ||
| 178 | ln -sf ${base_sbindir}/swapon.${PN} ${D}${base_sbindir}/swapoff.${PN} | ||
| 179 | ln -sf ${base_sbindir}/shutdown ${D}${base_sbindir}/reboot.${PN} | ||
| 180 | ln -sf ${base_sbindir}/shutdown ${D}${base_sbindir}/halt.${PN} | ||
| 181 | ln -sf ${base_sbindir}/shutdown ${D}${base_sbindir}/fastboot | ||
| 182 | ln -sf ${base_sbindir}/shutdown ${D}${base_sbindir}/fasthalt | ||
| 183 | } | ||
| 184 | |||
| 185 | python populate_packages_prepend () { | ||
| 186 | ulinxng_libdir = bb.data.expand('${libdir}', d) | ||
| 187 | ulinxng_libdir_dbg = bb.data.expand('${libdir}/.debug', d) | ||
| 188 | do_split_packages(d, ulinxng_libdir, '^lib(.*)\.so$', 'lib%s-dev', 'util-linux-ng %s development package', extra_depends='${PN}-dev', allow_links=True) | ||
| 189 | do_split_packages(d, ulinxng_libdir, '^lib(.*)\.la$', 'lib%s-dev', 'util-linux-ng %s development package', extra_depends='${PN}-dev') | ||
| 190 | do_split_packages(d, ulinxng_libdir, '^lib(.*)\.a$', 'lib%s-dev', 'util-linux-ng %s development package', extra_depends='${PN}-dev') | ||
| 191 | do_split_packages(d, ulinxng_libdir, '^lib(.*)\.so\.*', 'lib%s', 'util-linux-ng %s library', extra_depends='', allow_links=True) | ||
| 192 | } | ||
| 193 | |||
| 194 | |||
| 195 | pkg_postinst_${PN} () { | ||
| 196 | update-alternatives --install ${base_bindir}/dmesg dmesg dmesg.${PN} 100 | ||
| 197 | update-alternatives --install ${base_bindir}/kill kill kill.${PN} 100 | ||
| 198 | update-alternatives --install ${base_bindir}/more more more.${PN} 100 | ||
| 199 | update-alternatives --install ${base_sbindir}/mkswap mkswap mkswap.${PN} 100 | ||
| 200 | test -x ${base_sbindir}/pivot_root.${PN} && \ | ||
| 201 | update-alternatives --install ${base_sbindir}/pivot_root pivot_root pivot_root.${PN} 100 | ||
| 202 | update-alternatives --install ${base_sbindir}/sln sln sln.${PN} 100 | ||
| 203 | update-alternatives --install ${base_sbindir}/mkfs.minix mkfs.minix mkfs.minix.${PN} 100 | ||
| 204 | update-alternatives --install ${base_sbindir}/fsck.minix fsck.minix fsck.minix.${PN} 100 | ||
| 205 | update-alternatives --install ${bindir}/hexdump hexdump hexdump.${PN} 100 | ||
| 206 | update-alternatives --install ${bindir}/last last last.${PN} 100 | ||
| 207 | update-alternatives --install ${bindir}/logger logger logger.${PN} 100 | ||
| 208 | update-alternatives --install ${bindir}/mesg mesg mesg.${PN} 100 | ||
| 209 | update-alternatives --install ${bindir}/renice renice renice.${PN} 100 | ||
| 210 | update-alternatives --install ${bindir}/wall wall wall.${PN} 100 | ||
| 211 | update-alternatives --install ${bindir}/chfn chfn chfn.${PN} 100 | ||
| 212 | update-alternatives --install ${bindir}/newgrp newgrp newgrp.${PN} 100 | ||
| 213 | update-alternatives --install ${bindir}/chsh chsh chsh.${PN} 100 | ||
| 214 | update-alternatives --install ${bindir}/cal cal cal.${PN} 100 | ||
| 215 | update-alternatives --install ${bindir}/script script script.${PN} 100 | ||
| 216 | update-alternatives --install ${bindir}/flock flock flock.${PN} 100 | ||
| 217 | update-alternatives --install ${base_bindir}/login login login.${PN} 100 | ||
| 218 | update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 100 | ||
| 219 | update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 100 | ||
| 220 | update-alternatives --install ${bindir}/setsid setsid setsid.${PN} 100 | ||
| 221 | update-alternatives --install ${bindir}/chrt chrt chrt.${PN} 100 | ||
| 222 | |||
| 223 | # There seems to be problem, atleast on nslu2, with these, until they are | ||
| 224 | # fixed the busybox ones have higher priority | ||
| 225 | update-alternatives --install ${base_sbindir}/hwclock hwclock hwclock.${PN} 10 | ||
| 226 | update-alternatives --install ${base_sbindir}/shutdown shutdown shutdown.${PN} 10 | ||
| 227 | update-alternatives --install ${base_sbindir}/reboot reboot reboot.${PN} 10 | ||
| 228 | update-alternatives --install ${base_sbindir}/halt halt halt.${PN} 10 | ||
| 229 | } | ||
| 230 | |||
| 231 | pkg_prerm_${PN} () { | ||
| 232 | test -x ${base_sbindir}/pivot_root.${PN} && \ | ||
| 233 | update-alternatives --remove pivot_root pivot_root.${PN} | ||
| 234 | |||
| 235 | for i in dmesg kill more halt hwclock mkswap reboot shutdown sln mkfs.minix fsck.minix hexdump setsid chrt last logger mesg renice wall vipw vigr chfn newgrp chsh login cal script flock; do | ||
| 236 | update-alternatives --remove $i $i.${PN} | ||
| 237 | done | ||
| 238 | } | ||
| 239 | |||
| 240 | pkg_postinst_util-linux-ng-reset() { | ||
| 241 | update-alternatives --install ${bindir}/reset reset reset.${PN} 100 | ||
| 242 | } | ||
| 243 | |||
| 244 | pkg_prerm_util-linux-ng-reset () { | ||
| 245 | update-alternatives --remove reset reset.${PN} | ||
| 246 | } | ||
| 247 | |||
| 248 | pkg_postinst_util-linux-ng-fdisk () { | ||
| 249 | update-alternatives --install ${base_sbindir}/fdisk fdisk fdisk.${PN} 100 | ||
| 250 | } | ||
| 251 | |||
| 252 | pkg_prerm_util-linux-ng-fdisk () { | ||
| 253 | update-alternatives --remove fdisk fdisk.${PN} | ||
| 254 | } | ||
| 255 | |||
| 256 | pkg_postinst_util-linux-ng-mount () { | ||
| 257 | update-alternatives --install ${base_bindir}/mount mount mount.${PN} 100 | ||
| 258 | } | ||
| 259 | |||
| 260 | pkg_prerm_util-linux-ng-mount () { | ||
| 261 | update-alternatives --remove mount mount.${PN} | ||
| 262 | } | ||
| 263 | |||
| 264 | pkg_postinst_util-linux-ng-umount () { | ||
| 265 | update-alternatives --install ${base_bindir}/umount umount umount.${PN} 100 | ||
| 266 | } | ||
| 267 | |||
| 268 | pkg_prerm_util-linux-ng-umount () { | ||
| 269 | update-alternatives --remove umount umount.${PN} | ||
| 270 | } | ||
| 271 | |||
| 272 | pkg_postinst_util-linux-ng-losetup () { | ||
| 273 | update-alternatives --install ${base_sbindir}/losetup losetup losetup.${PN} 100 | ||
| 274 | } | ||
| 275 | |||
| 276 | pkg_prerm_util-linux-ng-losetup () { | ||
| 277 | update-alternatives --remove losetup losetup.${PN} | ||
| 278 | } | ||
| 279 | |||
| 280 | pkg_postinst_util-linux-ng-swaponoff () { | ||
| 281 | update-alternatives --install ${base_sbindir}/swapoff swapoff swapon.${PN} 100 | ||
| 282 | update-alternatives --install ${base_sbindir}/swapon swapon swapon.${PN} 100 | ||
| 283 | } | ||
| 284 | |||
| 285 | pkg_prerm_util-linux-ng-swaponoff () { | ||
| 286 | update-alternatives --remove swapoff swapon.${PN} | ||
| 287 | update-alternatives --remove swapon swapon.${PN} | ||
| 288 | } | ||
| 289 | |||
| 290 | pkg_postinst_util-linux-ng-readprofile() { | ||
| 291 | update-alternatives --install ${sbindir}/readprofile readprofile readprofile.${PN} 100 | ||
| 292 | } | ||
| 293 | |||
| 294 | pkg_prerm_util-linux-ng-readprofile () { | ||
| 295 | update-alternatives --remove readprofile readprofile.${PN} 100 | ||
| 296 | } | ||
| 297 | |||
| 298 | pkg_postinst_util-linux-ng-mountall () { | ||
| 299 | update-alternatives --install ${sysconfdir}/default/mountall default_mountall mountall.${PN} 100 | ||
| 300 | } | ||
| 301 | pkg_prerm_util-linux-ng-mountall () { | ||
| 302 | update-alternatives --remove default_mountall mountall.${PN} | ||
| 303 | } | ||
| 304 | |||
| 305 | pkg_postinst_util-linux-ng-fsck () { | ||
| 306 | update-alternatives --install ${base_sbindir}/fsck fsck fsck.${PN} 100 | ||
| 307 | } | ||
| 308 | |||
| 309 | pkg_prerm_util-linux-ng-fsck () { | ||
| 310 | update-alternatives --remove fsck fsck.${PN} | ||
| 311 | } | ||
| 312 | |||
| 313 | pkg_postinst_util-linux-ng-blkid () { | ||
| 314 | update-alternatives --install ${base_sbindir}/blkid blkid blkid.${PN} 100 | ||
| 315 | } | ||
| 316 | |||
| 317 | pkg_prerm_util-linux-ng-blkid () { | ||
| 318 | update-alternatives --remove blkid blkid.${PN} | ||
| 319 | } | ||
| 320 | |||
| 321 | BBCLASSEXTEND = "native" | ||
