blob: 4313ffe9527e0abee5ba49dbbc2c56a95319af52 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "Tools to change and administer password and group data"
2HOMEPAGE = "http://pkg-shadow.alioth.debian.org"
3BUGTRACKER = "https://alioth.debian.org/tracker/?group_id=30580"
4SECTION = "base/utils"
5LICENSE = "BSD | Artistic-1.0"
6LIC_FILES_CHKSUM = "file://COPYING;md5=ed80ff1c2b40843cf5768e5229cf16e5 \
7 file://src/passwd.c;beginline=8;endline=30;md5=d83888ea14ae61951982d77125947661"
8
9DEPENDS = "shadow-native"
10DEPENDS_class-native = ""
11DEPENDS_class-nativesdk = ""
12
13SRC_URI = "http://pkg-shadow.alioth.debian.org/releases/${BPN}-${PV}.tar.xz \
14 file://shadow-4.1.3-dots-in-usernames.patch \
15 file://usermod-fix-compilation-failure-with-subids-disabled.patch \
16 file://fix-installation-failure-with-subids-disabled.patch \
17 file://0001-Do-not-read-login.defs-before-doing-chroot.patch \
18 file://check_size_of_uid_t_and_gid_t_using_AC_CHECK_SIZEOF.patch \
19 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
20 "
21
22SRC_URI_append_class-target = " \
23 file://login_defs_pam.sed \
24 file://shadow-update-pam-conf.patch \
25 "
26
27SRC_URI_append_class-native = " \
28 file://disable-syslog.patch \
29 file://allow-for-setting-password-in-clear-text.patch \
30 file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
31 file://0001-useradd.c-create-parent-directories-when-necessary.patch \
32 "
33SRC_URI_append_class-nativesdk = " \
34 file://disable-syslog.patch \
35 "
36
37SRC_URI[md5sum] = "2bfafe7d4962682d31b5eba65dba4fc8"
38SRC_URI[sha256sum] = "3b0893d1476766868cd88920f4f1231c4795652aa407569faff802bcda0f3d41"
39
40# Additional Policy files for PAM
41PAM_SRC_URI = "file://pam.d/chfn \
42 file://pam.d/chpasswd \
43 file://pam.d/chsh \
44 file://pam.d/login \
45 file://pam.d/newusers \
46 file://pam.d/passwd \
47 file://pam.d/su"
48
49inherit autotools gettext
50
51EXTRA_OECONF += "--without-audit \
52 --without-libcrack \
53 --without-selinux \
54 --with-group-name-max-length=24 \
55 --enable-subordinate-ids=yes \
56 ${NSCDOPT}"
57
58NSCDOPT = ""
59NSCDOPT_class-native = "--without-nscd"
60NSCDOPT_class-nativesdk = "--without-nscd"
61NSCDOPT_libc-uclibc = " --without-nscd"
62NSCDOPT_libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'libc-spawn', '--with-nscd', '--without-nscd', d)}"
63
64PAM_PLUGINS = "libpam-runtime \
65 pam-plugin-faildelay \
66 pam-plugin-securetty \
67 pam-plugin-nologin \
68 pam-plugin-env \
69 pam-plugin-group \
70 pam-plugin-limits \
71 pam-plugin-lastlog \
72 pam-plugin-motd \
73 pam-plugin-mail \
74 pam-plugin-shells \
75 pam-plugin-rootok"
76
77PACKAGECONFIG = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
78PACKAGECONFIG_class-native = ""
79PACKAGECONFIG_class-nativesdk = ""
80PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
81PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
82PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
83
84RDEPENDS_${PN} = "shadow-securetty \
85 base-passwd \
86 util-linux-sulogin"
87RDEPENDS_${PN}_class-native = ""
88RDEPENDS_${PN}_class-nativesdk = ""
89
90do_install() {
91 oe_runmake DESTDIR="${D}" sbindir="${base_sbindir}" usbindir="${sbindir}" install
92
93 # Info dir listing isn't interesting at this point so remove it if it exists.
94 if [ -e "${D}${infodir}/dir" ]; then
95 rm -f ${D}${infodir}/dir
96 fi
97
98 # Enable CREATE_HOME by default.
99 sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs
100
101 # As we are on an embedded system, ensure the users mailbox is in
102 # ~/ not /var/spool/mail by default, as who knows where or how big
103 # /var is. The system MDA will set this later anyway.
104 sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs
105 sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs
106
107 # Disable checking emails.
108 sed -i 's/MAIL_CHECK_ENAB/#MAIL_CHECK_ENAB/g' ${D}${sysconfdir}/login.defs
109
110 # Comment out SU_NAME to work correctly with busybox
111 # See Bug#5359 and Bug#7173
112 sed -i 's:^SU_NAME:#SU_NAME:g' ${D}${sysconfdir}/login.defs
113
114 # Use proper encryption for passwords
115 sed -i 's/^#ENCRYPT_METHOD.*$/ENCRYPT_METHOD SHA512/' ${D}${sysconfdir}/login.defs
116
117 # Now we don't have a mail system. Disable mail creation for now.
118 sed -i 's:/bin/bash:/bin/sh:g' ${D}${sysconfdir}/default/useradd
119 sed -i '/^CREATE_MAIL_SPOOL/ s:^:#:' ${D}${sysconfdir}/default/useradd
120
121 # Use users group by default
122 sed -i 's,^GROUP=1000,GROUP=100,g' ${D}${sysconfdir}/default/useradd
123}
124
125do_install_append() {
126 # Ensure that the image has as a /var/spool/mail dir so shadow can
127 # put mailboxes there if the user reconfigures shadow to its
128 # defaults (see sed below).
129 install -d ${D}${localstatedir}/spool/mail
130
131 if [ -e ${WORKDIR}/pam.d ]; then
132 install -d ${D}${sysconfdir}/pam.d/
133 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
134 # Remove defaults that are not used when supporting PAM.
135 sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
136 fi
137
138 install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
139
140 # Move binaries to the locations we want
141 rm ${D}${sbindir}/vigr
142 ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr
143 if [ "${sbindir}" != "${base_sbindir}" ]; then
144 mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw
145 fi
146 if [ "${bindir}" != "${base_bindir}" ]; then
147 mv ${D}${bindir}/login ${D}${base_bindir}/login
148 mv ${D}${bindir}/su ${D}${base_bindir}/su
149 fi
150
151 # Handle link properly after rename, otherwise missing files would
152 # lead rpm failed dependencies.
153 ln -sf newgrp.${BPN} ${D}${bindir}/sg
154}
155
156PACKAGES =+ "${PN}-base"
157FILES_${PN}-base = "\
158 ${base_bindir}/login.shadow \
159 ${base_bindir}/su.shadow \
160 ${bindir}/sg \
161 ${bindir}/newgrp.shadow \
162 ${bindir}/groups.shadow \
163 ${sysconfdir}/pam.d/login \
164 ${sysconfdir}/pam.d/su \
165 ${sysconfdir}/login.defs \
166"
167RDEPENDS_${PN} += "${PN}-base"
168
169inherit update-alternatives
170
171ALTERNATIVE_PRIORITY = "200"
172
173ALTERNATIVE_${PN} = "passwd chfn chsh chpasswd vipw vigr"
174ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
175ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
176ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
177
178ALTERNATIVE_${PN}-base = "newgrp groups login su"
179ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
180ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
181
182ALTERNATIVE_${PN}-doc = "passwd.5 getspnam.3 groups.1"
183ALTERNATIVE_LINK_NAME[passwd.5] = "${mandir}/man5/passwd.5"
184ALTERNATIVE_LINK_NAME[getspnam.3] = "${mandir}/man3/getspnam.3"
185ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
186
187pkg_postinst_${PN} () {
188 if [ "x$D" != "x" ]; then
189 rootarg="--root $D"
190 else
191 rootarg=""
192 fi
193
194 pwconv $rootarg || exit 1
195 grpconv $rootarg || exit 1
196}