shadow: Turn shadow-native into a BBCLASSEXTEND

(From OE-Core rev: 44fafdb5eca1fc8766bf649bc78e770e1d18979d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2013-09-23 21:40:28 +00:00
parent 9bed1a3e52
commit 139e887c9a
3 changed files with 113 additions and 108 deletions

View File

@ -1,15 +0,0 @@
require shadow.inc
PR = "r8"
SRC_URI += " \
file://add_root_cmd_options.patch \
file://disable-syslog.patch \
file://useradd.patch \
file://add_root_cmd_groupmems.patch \
"
inherit native
EXTRA_OECONF += "--without-libpam \
--without-nscd"

View File

@ -7,22 +7,79 @@ LICENSE = "BSD | Artistic-1.0"
LIC_FILES_CHKSUM = "file://COPYING;md5=08c553a87d4e51bbed50b20e0adcaede \
file://src/passwd.c;beginline=8;endline=30;md5=d83888ea14ae61951982d77125947661"
DEPENDS = "shadow-native"
DEPENDS_class-native = ""
SRC_URI = "http://pkg-shadow.alioth.debian.org/releases/${BPN}-${PV}.tar.bz2 \
file://shadow.automake-1.11.patch \
file://shadow_fix_for_automake-1.12.patch \
file://shadow-4.1.3-dots-in-usernames.patch \
file://shadow-4.1.4.2-env-reset-keep-locale.patch \
${@base_contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
"
SRC_URI_append_class-target = " \
file://login_defs_pam.sed \
file://shadow-4.1.4.2-groupmod-pam-check.patch \
file://shadow-4.1.4.2-su_no_sanitize_env.patch \
file://shadow-update-pam-conf.patch \
file://slackware_fix_for_glib-2.17_crypt.patch \
file://fix-etc-gshadow-reading.patch \
"
SRC_URI_append_class-native = " \
file://add_root_cmd_options.patch \
file://disable-syslog.patch \
file://useradd.patch \
file://add_root_cmd_groupmems.patch \
"
SRC_URI[md5sum] = "b8608d8294ac88974f27b20f991c0e79"
SRC_URI[sha256sum] = "633f5bb4ea0c88c55f3642c97f9d25cbef74f82e0b4cf8d54e7ad6f9f9caa778"
PR = "r13"
# Additional Policy files for PAM
PAM_SRC_URI = "file://pam.d/chfn \
file://pam.d/chpasswd \
file://pam.d/chsh \
file://pam.d/login \
file://pam.d/newusers \
file://pam.d/passwd \
file://pam.d/su"
inherit autotools gettext
EXTRA_OECONF += "--without-audit \
--without-libcrack \
--without-selinux"
--without-selinux \
${NSCDOPT}"
NSCDOPT = ""
NSCDOPT_class-native = "--without-nscd"
NSCDOPT_libc-uclibc = " --without-nscd"
PAM_PLUGINS = "libpam-runtime \
pam-plugin-faildelay \
pam-plugin-securetty \
pam-plugin-nologin \
pam-plugin-env \
pam-plugin-group \
pam-plugin-limits \
pam-plugin-lastlog \
pam-plugin-motd \
pam-plugin-mail \
pam-plugin-shells \
pam-plugin-rootok"
PACKAGECONFIG = "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
PACKAGECONFIG_class-native = ""
PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
RDEPENDS_${PN} = "shadow-securetty \
base-passwd"
RDEPENDS_${PN}_class-native = ""
do_install() {
oe_runmake DESTDIR="${D}" sbindir="${base_sbindir}" usbindir="${sbindir}" install
@ -51,3 +108,55 @@ do_install() {
sed -i 's,^GROUP=1000,GROUP=100,g' ${D}${sysconfdir}/default/useradd
}
do_install_append() {
# Ensure that the image has as a /var/spool/mail dir so shadow can
# put mailboxes there if the user reconfigures shadow to its
# defaults (see sed below).
install -d ${D}${localstatedir}/spool/mail
if [ -e ${WORKDIR}/pam.d ]; then
install -d ${D}${sysconfdir}/pam.d/
install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
# Remove defaults that are not used when supporting PAM.
sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
fi
install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
# Move binaries to the locations we want
rm ${D}${sbindir}/vigr
ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr
if [ "${sbindir}" != "${base_sbindir}" ]; then
mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw
fi
if [ "${bindir}" != "${base_bindir}" ]; then
mv ${D}${bindir}/login ${D}${base_bindir}/login
mv ${D}${bindir}/su ${D}${base_bindir}/su
fi
# Handle link properly after rename, otherwise missing files would
# lead rpm failed dependencies.
ln -sf newgrp.${BPN} ${D}${bindir}/sg
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "200"
ALTERNATIVE_${PN} = "passwd chfn newgrp chsh groups chpasswd login vipw vigr su"
ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
pkg_postinst_${PN} () {
if [ "x$D" != "x" ]; then
rootarg="--root=$D"
else
rootarg=""
fi
pwconv $rootarg
grpconv $rootarg
}

View File

@ -1,99 +1,10 @@
require shadow.inc
DEPENDS = "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)} \
shadow-native"
RDEPENDS_${PN} = "shadow-securetty ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)} \
base-passwd"
PR = "r13"
SRC_URI += " \
file://login_defs_pam.sed \
${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
file://shadow-4.1.4.2-groupmod-pam-check.patch \
file://shadow-4.1.4.2-su_no_sanitize_env.patch \
file://shadow-update-pam-conf.patch \
file://slackware_fix_for_glib-2.17_crypt.patch \
file://fix-etc-gshadow-reading.patch \
"
EXTRA_OECONF += "${@base_contains('DISTRO_FEATURES', 'pam', '--with-libpam', '--without-libpam', d)}"
EXTRA_OECONF_libc-uclibc += "--with-nscd=no"
# Build falsely assumes that if --enable-libpam is set, we don't need to link against
# libcrypt. This breaks chsh.
BUILD_LDFLAGS += "${@base_contains('DISTRO_FEATURES', 'pam', base_contains('DISTRO_FEATURES', 'libc-crypt', '-lcrypt', '', d), '', d)}"
BUILD_LDFLAGS_append_class-target = " ${@base_contains('DISTRO_FEATURES', 'pam', base_contains('DISTRO_FEATURES', 'libc-crypt', '-lcrypt', '', d), '', d)}"
PAM_PLUGINS = "libpam-runtime \
pam-plugin-faildelay \
pam-plugin-securetty \
pam-plugin-nologin \
pam-plugin-env \
pam-plugin-group \
pam-plugin-limits \
pam-plugin-lastlog \
pam-plugin-motd \
pam-plugin-mail \
pam-plugin-shells \
pam-plugin-rootok"
BBCLASSEXTEND = "native"
# Additional Policy files for PAM
PAM_SRC_URI = "file://pam.d/chfn \
file://pam.d/chpasswd \
file://pam.d/chsh \
file://pam.d/login \
file://pam.d/newusers \
file://pam.d/passwd \
file://pam.d/su"
do_install_append() {
# Ensure that the image has as a /var/spool/mail dir so shadow can
# put mailboxes there if the user reconfigures shadow to its
# defaults (see sed below).
install -d ${D}${localstatedir}/spool/mail
if [ -e ${WORKDIR}/pam.d ]; then
install -d ${D}${sysconfdir}/pam.d/
install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
# Remove defaults that are not used when supporting PAM.
sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
fi
install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
# Move binaries to the locations we want
rm ${D}${sbindir}/vigr
ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr
if [ "${sbindir}" != "${base_sbindir}" ]; then
mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw
fi
if [ "${bindir}" != "${base_bindir}" ]; then
mv ${D}${bindir}/login ${D}${base_bindir}/login
mv ${D}${bindir}/su ${D}${base_bindir}/su
fi
# Handle link properly after rename, otherwise missing files would
# lead rpm failed dependencies.
ln -sf newgrp.${BPN} ${D}${bindir}/sg
}
inherit update-alternatives
ALTERNATIVE_PRIORITY = "200"
ALTERNATIVE_${PN} = "passwd chfn newgrp chsh groups chpasswd login vipw vigr su"
ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
pkg_postinst_${PN} () {
if [ "x$D" != "x" ]; then
rootarg="--root=$D"
else
rootarg=""
fi
pwconv $rootarg
grpconv $rootarg
}