[OE-core] [PATCH 09/17] shadow: Use update-alternatives
Mark Hatle
mark.hatle at windriver.com
Mon Apr 16 23:16:03 UTC 2012
Switch to using ALTERNATIVE_LINKS to ensure the update-alternatives are setup
properly, along with the package provides.
Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
---
meta/recipes-extended/shadow/shadow_4.1.4.3.bb | 42 +++++++++++------------
1 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/meta/recipes-extended/shadow/shadow_4.1.4.3.bb b/meta/recipes-extended/shadow/shadow_4.1.4.3.bb
index f892eb9..e27ca47 100644
--- a/meta/recipes-extended/shadow/shadow_4.1.4.3.bb
+++ b/meta/recipes-extended/shadow/shadow_4.1.4.3.bb
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=08c553a87d4e51bbed50b20e0adcaede \
DEPENDS = "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
RDEPENDS_${PN} = "shadow-securetty ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
-PR = "r8"
+PR = "r9"
SRC_URI = "http://pkg-shadow.alioth.debian.org/releases/${BPN}-${PV}.tar.bz2 \
file://login_defs_pam.sed \
@@ -84,14 +84,12 @@ do_install_append() {
sed -i '/^CREATE_MAIL_SPOOL/ s:^:#:' ${D}${sysconfdir}/default/useradd
install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
- for i in passwd chfn newgrp chsh groups ; do
- mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}
- done
- mv ${D}${sbindir}/chpasswd ${D}${sbindir}/chpasswd.${PN}
+ # We create the ${PN} versions to avoid link problems
+ mv ${D}${bindir}/newgrp ${D}${bindir}/newgrp.${PN}
mv ${D}${sbindir}/vigr ${D}${base_sbindir}/vigr.${PN}
mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw.${PN}
- mv ${D}${bindir}/login ${D}${base_bindir}/login.${PN}
+ mv ${D}${bindir}/login ${D}${base_bindir}/login
# Handle link properly after rename, otherwise missing files would
# lead rpm failed dependencies.
@@ -99,17 +97,23 @@ do_install_append() {
ln -sf newgrp.${PN} ${D}${bindir}/sg
}
-pkg_postinst_${PN} () {
- update-alternatives --install ${bindir}/passwd passwd passwd.${PN} 200
- update-alternatives --install ${sbindir}/chpasswd chpasswd chpasswd.${PN} 200
- update-alternatives --install ${bindir}/chfn chfn chfn.${PN} 200
- update-alternatives --install ${bindir}/newgrp newgrp newgrp.${PN} 200
- update-alternatives --install ${bindir}/chsh chsh chsh.${PN} 200
- update-alternatives --install ${bindir}/groups groups groups.${PN} 200
- update-alternatives --install ${base_bindir}/login login login.${PN} 200
- update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 200
- update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 200
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "200"
+
+bindir_progs = "passwd chfn newgrp chsh groups"
+ALTERNATIVE_LINKS += "${bindir}/${@' ${bindir}/'.join((d.getVar('bindir_progs', True)).split())}"
+
+sbindir_progs = "chpasswd"
+ALTERNATIVE_LINKS += "${sbindir}/${@' ${sbindir}/'.join((d.getVar('sbindir_progs', True)).split())}"
+
+base_bindir_progs = "login"
+ALTERNATIVE_LINKS += "${base_bindir}/${@' ${base_bindir}/'.join((d.getVar('base_bindir_progs', True)).split())}"
+base_sbindir_progs = "vipw vigr"
+ALTERNATIVE_LINKS += "${base_sbindir}/${@' ${base_sbindir}/'.join((d.getVar('base_sbindir_progs', True)).split())}"
+
+pkg_postinst_${PN} () {
if [ "x$D" != "x" ]; then
rootarg="--root=$D"
else
@@ -119,9 +123,3 @@ pkg_postinst_${PN} () {
pwconv $rootarg
grpconv $rootarg
}
-
-pkg_prerm_${PN} () {
- for i in passwd chpasswd chfn newgrp chsh login vipw vigr ; do
- update-alternatives --remove $i $i.${PN}
- done
-}
--
1.7.3.4
More information about the Openembedded-core
mailing list