diff options
author | Chris Larson <clarson@mvista.com> | 2010-01-07 13:25:13 -0700 |
---|---|---|
committer | Chris Larson <clarson@mvista.com> | 2010-01-22 09:39:10 -0700 |
commit | 0174458a6214e8111f527c0030a868aecf876e05 (patch) | |
tree | fe050684f5820dd46d3b704e13211475732f675d /recipes/shadow/shadow.inc | |
parent | 53c1e82f6515c00daff1e0bf74eb08e6b5bcd3c7 (diff) |
shadow: reorg into .inc, pull some mvl6 changes over, use a 'pam' distro feature.
Signed-off-by: Chris Larson <clarson@mvista.com>
Diffstat (limited to 'recipes/shadow/shadow.inc')
-rw-r--r-- | recipes/shadow/shadow.inc | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/recipes/shadow/shadow.inc b/recipes/shadow/shadow.inc new file mode 100644 index 0000000000..83d06c36a4 --- /dev/null +++ b/recipes/shadow/shadow.inc @@ -0,0 +1,91 @@ +# Configuration parameters +SHADOW_MAILFILE ?= "Mailbox" +SHADOW_MAILDIR ?= "${localstatedir}/spool/mail" +SHADOW_UTMPDIR ?= "${localstatedir}/utmp" +SHADOW_LOGDIR ?= "${localstatedir}/log" + +# Metadata +DESCRIPTION = "Tools to change and administer password and group data." +HOMEPAGE = "http://pkg-shadow.alioth.debian.org/" +LICENSE = "BSD" +SECTION = "base" +DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" + +INC_PR = "r6" + +# 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 \ +" +SRC_URI = "ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-${PV}.tar.bz2 \ + file://login_defs_pam.sed \ + ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \ + file://securetty \ +" + +inherit autotools gettext + +EXTRA_OECONF += "\ + --disable-account-tools-setuid \ + --without-audit \ + --without-selinux \ + --without-libcrack \ + ${@base_contains('DISTRO_FEATURES', 'pam', '--with-libpam', '--without-libpam', d)} \ +" + +CFLAGS += "-I../include" + +do_configure_prepend () { + export CONFIG_SITE="${CONFIG_SITE} ${B}/cachedpaths" + cat <<END >${B}/cachedpaths +shadow_cv_maildir=${SHADOW_MAILDIR} +shadow_cv_mailfile=${SHADOW_MAILFILE} +shadow_cv_utmpdir=${SHADOW_UTMPDIR} +shadow_cv_logdir=${SHADOW_LOGDIR} +shadow_cv_passwd_dir=${bindir} +END +} + +do_install_append() { + # Ensure that the image has as /var/spool/mail dir so shadow can put mailboxes there if the user + # reconfigures Shadow to default (see sed below). + install -d ${D}${SHADOW_MAILDIR} + + if [ -e ${WORKDIR}/pam.d ]; then + install -d ${D}${sysconfdir}/pam.d/ + install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/ + fi + + # Remove defaults that are not used when supporting PAM + ${@base_contains('DISTRO_FEATURES', 'pam', 'sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs', '', d)} + + # Enable CREATE_HOME by default. + sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs + + # As we are on an embedded system ensure the users mailbox is in ~/ not + # /var/spool/mail by default as who knows where or how big /var is. + # The system MDA will set this later anyway. + sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs + sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs + + mv ${D}${sbindir}/chpasswd ${D}${sbindir}/chpasswd.${PN} + mv ${D}${bindir}/passwd ${D}${bindir}/chpasswd.${PN} + + install -m 0644 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty +} + +pkg_postinst_${PN} () { + update-alternatives --install ${bindir}/passwd passwd passwd.${PN} 100 + update-alternatives --install ${sbindir}/chpasswd chpasswd chpasswd.${PN} 100 +} + +pkg_prerm_${PN} () { + update-alternatives --remove passwd passwd.${PN} + update-alternatives --remove chpasswd chpasswd.${PN} +} |