1 SUMMARY = "Tools to change and administer password and group data"
2 HOMEPAGE = "http://github.com/shadow-maint/shadow"
3 DESCRIPTION = "${SUMMARY}"
4 BUGTRACKER = "http://github.com/shadow-maint/shadow/issues"
6 LICENSE = "BSD-3-Clause"
7 LIC_FILES_CHKSUM = "file://COPYING;md5=c9a450b7be84eac23e6353efecb60b5b \
8 file://src/passwd.c;beginline=2;endline=7;md5=67bcf314687820b2f010d4863fce3fc5 \
11 DEPENDS = "virtual/crypt"
13 GITHUB_BASE_URI = "https://github.com/shadow-maint/shadow/releases"
14 SRC_URI = "${GITHUB_BASE_URI}/download/${PV}/${BP}.tar.gz \
15 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
19 SRC_URI:append:class-target = " \
20 file://login_defs_pam.sed \
21 file://shadow-update-pam-conf.patch \
24 SRC_URI:append:class-native = " \
25 file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
27 SRC_URI[sha256sum] = "a305edf5d19bddbdf5e836d2d609fa8bff2d35458819de4d9f06306a1cf24342"
29 # Additional Policy files for PAM
30 PAM_SRC_URI = "file://pam.d/chfn \
31 file://pam.d/chpasswd \
34 file://pam.d/newusers \
38 inherit autotools gettext github-releases pkgconfig
40 export CONFIG_SHELL="/bin/sh"
42 EXTRA_OECONF += "--without-libcrack \
43 --with-group-name-max-length=24 \
44 --enable-subordinate-ids=yes \
48 CFLAGS:append:libc-musl = " -DLIBBSD_OVERLAY"
51 NSCDOPT:class-native = "--without-nscd"
52 NSCDOPT:class-nativesdk = "--without-nscd"
53 NSCDOPT:libc-glibc = "--with-nscd"
55 PAM_PLUGINS = "libpam-runtime \
56 pam-plugin-faildelay \
57 pam-plugin-securetty \
67 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)} \
68 ${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)}"
69 PACKAGECONFIG:class-native ??= "${@bb.utils.contains('DISTRO_FEATURES', 'xattr', 'attr', '', d)} libbsd"
70 PACKAGECONFIG:class-nativesdk = ""
71 PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
72 PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
73 PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
74 PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit"
75 PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux libsemanage"
76 PACKAGECONFIG[libbsd] = "--with-libbsd,--without-libbsd,libbsd"
77 PACKAGECONFIG[logind] = "--enable-logind,--disable-logind,systemd"
79 RDEPENDS:${PN} = "shadow-securetty \
82 RDEPENDS:${PN}:class-native = ""
83 RDEPENDS:${PN}:class-nativesdk = ""
86 oe_runmake DESTDIR="${D}" sbindir="${base_sbindir}" usbindir="${sbindir}" install
88 # Info dir listing isn't interesting at this point so remove it if it exists.
89 if [ -e "${D}${infodir}/dir" ]; then
90 rm -f ${D}${infodir}/dir
93 # Enable CREATE_HOME by default.
94 sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs
96 # As we are on an embedded system, ensure the users mailbox is in
97 # ~/ not /var/spool/mail by default, as who knows where or how big
98 # /var is. The system MDA will set this later anyway.
99 sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs
100 sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs
102 # Disable checking emails.
103 sed -i 's/MAIL_CHECK_ENAB/#MAIL_CHECK_ENAB/g' ${D}${sysconfdir}/login.defs
105 # Comment out SU_NAME to work correctly with busybox
106 # See Bug#5359 and Bug#7173
107 sed -i 's:^SU_NAME:#SU_NAME:g' ${D}${sysconfdir}/login.defs
109 # Use proper encryption for passwords
110 sed -i 's/^#ENCRYPT_METHOD.*$/ENCRYPT_METHOD SHA512/' ${D}${sysconfdir}/login.defs
112 install -d ${D}${sysconfdir}/default
113 install -m 0644 ${WORKDIR}/useradd ${D}${sysconfdir}/default
116 do_install:append() {
117 # Ensure that the image has as a /var/spool/mail dir so shadow can
118 # put mailboxes there if the user reconfigures shadow to its
119 # defaults (see sed below).
120 install -m 0775 -d ${D}${localstatedir}/spool/mail
121 chown root:mail ${D}${localstatedir}/spool/mail
123 if [ -e ${WORKDIR}/pam.d ]; then
124 install -d ${D}${sysconfdir}/pam.d/
125 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
126 # Remove defaults that are not used when supporting PAM.
127 sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
130 install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
132 # Move binaries to the locations we want
133 rm ${D}${sbindir}/vigr
134 ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr
135 if [ "${sbindir}" != "${base_sbindir}" ]; then
136 mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw
138 if [ "${bindir}" != "${base_bindir}" ]; then
139 mv ${D}${bindir}/login ${D}${base_bindir}/login
140 mv ${D}${bindir}/su ${D}${base_bindir}/su
143 # Handle link properly after rename, otherwise missing files would
144 # lead rpm failed dependencies.
145 ln -sf newgrp.${BPN} ${D}${bindir}/sg
147 # usermod requires the subuid/subgid files to be in place before being
148 # able to use the -v/-V flags otherwise it fails:
149 # usermod: /etc/subuid does not exist, you cannot use the flags -v or -V
150 install -d ${D}${sysconfdir}
151 touch ${D}${sysconfdir}/subuid
152 touch ${D}${sysconfdir}/subgid
155 # Make executables look for dynamically linked libraries in a custom location, and install
156 # the needed libraries there. That way we can use them from sstate
157 # in setscene tasks without worrying about the dependency libraries being available.
158 do_install:append:class-native() {
159 binaries=$(find ${D}${base_bindir}/ ${D}${base_sbindir}/ ${D}${bindir}/ ${D}${sbindir}/ -executable -type f)
160 chrpath -k -r ${STAGING_DIR_NATIVE}/lib-shadow-deps $binaries
161 mkdir -p ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/
162 install ${STAGING_LIBDIR_NATIVE}/libattr.so.* ${STAGING_LIBDIR_NATIVE}/libbsd.so.* ${STAGING_LIBDIR_NATIVE}/libmd.so.* ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/
163 install ${D}${libdir}/*.so.* ${D}${STAGING_DIR_NATIVE}/lib-shadow-deps/
166 SYSROOT_DIRS:append:class-native = " ${STAGING_DIR_NATIVE}/lib-shadow-deps/"
167 INSANE_SKIP:${PN}:class-native = "already-stripped"
169 PACKAGES =+ "${PN}-base"
170 FILES:${PN}-base = "\
171 ${base_bindir}/login.shadow \
172 ${base_bindir}/su.shadow \
174 ${bindir}/newgrp.shadow \
175 ${bindir}/groups.shadow \
176 ${sysconfdir}/pam.d/login \
177 ${sysconfdir}/pam.d/su \
178 ${sysconfdir}/login.defs \
180 RDEPENDS:${PN} += "${PN}-base"
182 inherit update-alternatives
184 ALTERNATIVE_PRIORITY = "200"
186 ALTERNATIVE:${PN} = "passwd chfn chsh chpasswd vipw vigr nologin"
187 ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
188 ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
189 ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
190 ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
191 ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
192 ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
194 ALTERNATIVE:${PN}-base = "newgrp groups login su"
195 ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
196 ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
198 PACKAGE_WRITE_DEPS += "shadow-native"
199 pkg_postinst:${PN}:class-target () {
200 if [ "x$D" != "x" ]; then
206 pwconv $rootarg || exit 1
207 grpconv $rootarg || exit 1