Skip to contentSkip to conversation

shadow: use update-alternatives to handle su.1 and nologin.8

PATCH New Sid-Ali Teir 1 participant 1 message Dec 6, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 shadow: use update-alternatives to handle su.1 and nologin.8

This patch fixes the following error at do_rootfs:

update-alternatives: Error: not linking
/PATH/TO/rootfs/usr/share/man/man1/su.1
to /usr/share/man/man1/su.1.util-linux since
/PATH/TO/rootfs/usr/share/man/man1/su.1
exists and is not a link

update-alternatives: Error: not linking /PATH/TO/rootfs/usr/share/man/man8/nologin.8 to /usr/share/man/man8/nologin.8.util-linux since /PATH/TO/rootfs/usr/share/man/man8/nologin.8 exists and is not a link

The problem can be reproduced by adding the following lines to local.conf and then building an image:

EXTRA_IMAGE_FEATURES:append = " doc-pkgs"
IMAGE_INSTALL:append = " shadow util-linux"

su.1 and nologin.8 are handled by update-alternatives in util-linux recipe, so do it in shadow recipe too.

---
 meta/recipes-extended/shadow/shadow.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-extended/shadow/shadow.inc +3 -1
index 171d6e27c3..6ba5a9c7f1 100644
@@ -200,10 +200,12 @@ ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
 ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
 ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
 
-ALTERNATIVE:${PN}-doc = "chfn.1 chsh.1 groups.1"
+ALTERNATIVE:${PN}-doc = "chfn.1 chsh.1 groups.1 su.1 nologin.8"
 ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1"
 ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1"
 ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
+ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
+ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
 
 ALTERNATIVE:${PN}-base = "newgrp groups login su"
 ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
Signature · 1 line
2.47.1