[v6,03/13] util-linux: fix the su and runuser packages

Submitted by André Draszik on Feb. 5, 2019, 2:32 a.m. | Patch ID: 158512

Details

Message ID 20190205023241.29707-4-git@andred.net
State New
Headers show

Commit Message

André Draszik Feb. 5, 2019, 2:32 a.m.
From: André Draszik <andre.draszik@jci.com>

The packages get an automatic RDEPENDS via shlibs, no
need to explicitly state it, so we can drop those
useless explicit assignments.

su is moved into ${base_bindir} in do_install(), so
because of a mismatched FILES specification su is
actually packaged into the main package at the moment,
not into the -su package as likely originally intended.

runuser needs the pam configuration files, so they should
be in the -runuser package, not in the main package.

While fixing this, we can simplify the update alternatives
processing for su.

[YOCTO #13058]

Signed-off-by: André Draszik <andre.draszik@jci.com>
---
 meta/recipes-core/util-linux/util-linux.inc | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index e479fc24e1..4a72e3d40e 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -96,7 +96,8 @@  FILES_util-linux-getopt = "${base_bindir}/getopt.${BPN}"
 FILES_util-linux-runuser = "${sbindir}/runuser"
 FILES_util-linux-prlimit = "${bindir}/prlimit"
 FILES_util-linux-ionice = "${bindir}/ionice.${BPN}"
-FILES_util-linux-su = "${bindir}/su.util-linux ${sysconfdir}/pam.d/su-l"
+FILES_util-linux-runuser = "${sysconfdir}/pam.d/runuser*"
+FILES_util-linux-su = "${base_bindir}/su.${BPN} ${sysconfdir}/pam.d/su-l"
 CONFFILES_util-linux-su = "${sysconfdir}/pam.d/su-l"
 
 FILES_util-linux-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
@@ -122,9 +123,6 @@  FILES_util-linux-blkid = "${base_sbindir}/blkid.${BPN}"
 RCONFLICTS_util-linux-blkid = "e2fsprogs-blkid"
 RREPLACES_util-linux-blkid = "e2fsprogs-blkid"
 
-RDEPENDS_util-linux-runuser += "libpam"
-RDEPENDS_util-linux-su += "libpam"
-
 RDEPENDS_${PN} = "util-linux-umount util-linux-swaponoff util-linux-losetup util-linux-sulogin util-linux-lsblk"
 RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'util-linux-runuser util-linux-su', '', d)}"
 
@@ -228,6 +226,7 @@  ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
 ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
 
 ALTERNATIVE_${PN}-doc = "mountpoint.1 last.1 lastb.1 mesg.1 wall.1 nologin.8 sulogin.8 utmpdump.1 rfkill.8 kill.1 libblkid.3 blkid.8 findfs.8 fsck.8 uuid.3 eject.1 logger.1"
+ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
 
 ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
 ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
@@ -235,6 +234,7 @@  ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
 ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
 ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
 ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
+ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
 ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
 ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
 ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
@@ -263,6 +263,9 @@  ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
 ALTERNATIVE_util-linux-mount = "mount"
 ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
 
+ALTERNATIVE_${PN}-su = "su"
+ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
+
 ALTERNATIVE_util-linux-umount = "umount"
 ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
 
@@ -305,15 +308,6 @@  ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
 
 BBCLASSEXTEND = "native nativesdk"
 
-python do_package_prepend () {
-    if '--enable-su' in d.getVar('EXTRA_OECONF').split():
-        d.appendVar(d.expand('ALTERNATIVE_${PN}'), ' su')
-        d.appendVar(d.expand('ALTERNATIVE_${PN}-doc'), ' su.1')
-
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', "su", d.expand('${base_bindir}/su'))
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', "su.1", d.expand('${mandir}/man1/su.1'))
-}
-
 python populate_packages_prepend() {
     do_split_packages(d, '${base_libdir}', r'^lib(.*)\.so\..*$',
                       output_pattern='util-linux-lib%s',