1 # Configuration parameters
2 SHADOW_MAILFILE ?= "Mailbox"
3 SHADOW_MAILDIR ?= "${localstatedir}/spool/mail"
4 SHADOW_UTMPDIR ?= "${localstatedir}/utmp"
5 SHADOW_LOGDIR ?= "${localstatedir}/log"
8 DESCRIPTION = "Tools to change and administer password and group data."
9 HOMEPAGE = "http://pkg-shadow.alioth.debian.org/"
12 DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
14 PACKAGE_ARCH_${PN} = "${MACHINE_ARCH}"
18 # Additional Policy files for PAM
21 file://pam.d/chpasswd \
24 file://pam.d/newusers \
29 SRC_URI = "ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-${PV}.tar.bz2 \
30 file://login_defs_pam.sed \
31 ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
35 inherit autotools gettext
38 --disable-account-tools-setuid \
42 ${@base_contains('DISTRO_FEATURES', 'pam', '--with-libpam', '--without-libpam', d)} \
45 CFLAGS += "-I../include"
47 do_configure_prepend () {
48 export CONFIG_SITE="${CONFIG_SITE} ${B}/cachedpaths"
49 cat <<END >${B}/cachedpaths
50 shadow_cv_maildir=${SHADOW_MAILDIR}
51 shadow_cv_mailfile=${SHADOW_MAILFILE}
52 shadow_cv_utmpdir=${SHADOW_UTMPDIR}
53 shadow_cv_logdir=${SHADOW_LOGDIR}
54 shadow_cv_passwd_dir=${bindir}
59 # Ensure that /etc/skel is created so any default files that we want copied into new users home
60 # dirs can be put in there later (ideal for .xinitrc for example).
61 install -d ${D}${sysconfdir}/skel/
63 # Ensure that the image has as /var/spool/mail dir so shadow can put mailboxes there if the user
64 # reconfigures Shadow to default (see sed below).
65 install -d ${D}${SHADOW_MAILDIR}
67 if [ -e ${WORKDIR}/pam.d ]; then
68 install -d ${D}${sysconfdir}/pam.d/
69 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
72 # Remove defaults that are not used when supporting PAM
73 ${@base_contains('DISTRO_FEATURES', 'pam', 'sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs', '', d)}
75 # Enable CREATE_HOME by default.
76 sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs
78 # As we are on an embedded system ensure the users mailbox is in ~/ not
79 # /var/spool/mail by default as who knows where or how big /var is.
80 # The system MDA will set this later anyway.
81 sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs
82 sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs
84 install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
85 for i in passwd chfn newgrp chsh ; do
86 mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}
89 mv ${D}${sbindir}/chpasswd ${D}${sbindir}/chpasswd.${PN}
90 mv ${D}${sbindir}/vigr ${D}${base_sbindir}/vigr.${PN}
91 mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw.${PN}
92 mv ${D}${bindir}/login ${D}${base_bindir}/login.${PN}
94 # Ensure we add a suitable securetty file to the package that has most common embedded TTYs defined.
95 if [ ! -z "${SERIAL_CONSOLE}" ]; then
96 # our SERIAL_CONSOLE contains baud rate too and sometime -L option as well.
97 # the following pearl :) takes that and converts it into newline sepated tty's and appends
98 # them into securetty. So if a machine has a weird looking console device node (e.g. ttyAMA0) that securetty
99 # does not know then it will get appended to securetty and root login will be allowed on
101 echo "${SERIAL_CONSOLE}" | sed -e 's/[0-9][0-9]\|\-L//g'|tr "[ ]" "[\n]" >> ${WORKDIR}/securetty
103 install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
106 pkg_postinst_${PN} () {
107 update-alternatives --install ${bindir}/passwd passwd passwd.${PN} 200
108 update-alternatives --install ${sbindir}/chpasswd chpasswd chpasswd.${PN} 200
109 update-alternatives --install ${bindir}/chfn chfn chfn.${PN} 200
110 update-alternatives --install ${bindir}/newgrp newgrp newgrp.${PN} 200
111 update-alternatives --install ${bindir}/chsh chsh chsh.${PN} 200
112 update-alternatives --install ${base_bindir}/login login login.${PN} 200
113 update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 200
114 update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 200
115 if [ "x$D" != "x" ]; then
123 for i in passwd chpasswd chfn newgrp chsh login vipw vigr ; do
124 update-alternatives --remove $i $i.${PN}