summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/shadow/shadow.inc
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/shadow/shadow.inc')
-rw-r--r--meta/recipes-extended/shadow/shadow.inc176
1 files changed, 176 insertions, 0 deletions
diff --git a/meta/recipes-extended/shadow/shadow.inc b/meta/recipes-extended/shadow/shadow.inc
new file mode 100644
index 0000000000..bb3a927c17
--- /dev/null
+++ b/meta/recipes-extended/shadow/shadow.inc
@@ -0,0 +1,176 @@
1SUMMARY = "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-su.c-fix-to-exec-command-correctly.patch \
18 file://0001-Do-not-read-login.defs-before-doing-chroot.patch \
19 file://check_size_of_uid_t_and_gid_t_using_AC_CHECK_SIZEOF.patch \
20 ${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)} \
21 "
22
23SRC_URI_append_class-target = " \
24 file://login_defs_pam.sed \
25 file://shadow-update-pam-conf.patch \
26 "
27
28SRC_URI_append_class-native = " \
29 file://disable-syslog.patch \
30 file://allow-for-setting-password-in-clear-text.patch \
31 file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
32 file://0001-useradd.c-create-parent-directories-when-necessary.patch \
33 "
34SRC_URI_append_class-nativesdk = " \
35 file://disable-syslog.patch \
36 "
37
38SRC_URI[md5sum] = "2bfafe7d4962682d31b5eba65dba4fc8"
39SRC_URI[sha256sum] = "3b0893d1476766868cd88920f4f1231c4795652aa407569faff802bcda0f3d41"
40
41# Additional Policy files for PAM
42PAM_SRC_URI = "file://pam.d/chfn \
43 file://pam.d/chpasswd \
44 file://pam.d/chsh \
45 file://pam.d/login \
46 file://pam.d/newusers \
47 file://pam.d/passwd \
48 file://pam.d/su"
49
50inherit autotools gettext
51
52EXTRA_OECONF += "--without-audit \
53 --without-libcrack \
54 --without-selinux \
55 --with-group-name-max-length=24 \
56 --enable-subordinate-ids=yes \
57 ${NSCDOPT}"
58
59NSCDOPT = ""
60NSCDOPT_class-native = "--without-nscd"
61NSCDOPT_class-nativesdk = "--without-nscd"
62NSCDOPT_libc-uclibc = " --without-nscd"
63NSCDOPT_libc-glibc = "${@bb.utils.contains('DISTRO_FEATURES', 'libc-spawn', '--with-nscd', '--without-nscd', d)}"
64
65PAM_PLUGINS = "libpam-runtime \
66 pam-plugin-faildelay \
67 pam-plugin-securetty \
68 pam-plugin-nologin \
69 pam-plugin-env \
70 pam-plugin-group \
71 pam-plugin-limits \
72 pam-plugin-lastlog \
73 pam-plugin-motd \
74 pam-plugin-mail \
75 pam-plugin-shells \
76 pam-plugin-rootok"
77
78PACKAGECONFIG = "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"
79PACKAGECONFIG_class-native = ""
80PACKAGECONFIG_class-nativesdk = ""
81PACKAGECONFIG[pam] = "--with-libpam,--without-libpam,libpam,${PAM_PLUGINS}"
82PACKAGECONFIG[attr] = "--with-attr,--without-attr,attr"
83PACKAGECONFIG[acl] = "--with-acl,--without-acl,acl"
84
85RDEPENDS_${PN} = "shadow-securetty \
86 base-passwd"
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 # Use proper encryption for passwords
111 sed -i 's/^#ENCRYPT_METHOD.*$/ENCRYPT_METHOD SHA512/' ${D}${sysconfdir}/login.defs
112
113 # Now we don't have a mail system. Disable mail creation for now.
114 sed -i 's:/bin/bash:/bin/sh:g' ${D}${sysconfdir}/default/useradd
115 sed -i '/^CREATE_MAIL_SPOOL/ s:^:#:' ${D}${sysconfdir}/default/useradd
116
117 # Use users group by default
118 sed -i 's,^GROUP=1000,GROUP=100,g' ${D}${sysconfdir}/default/useradd
119}
120
121do_install_append() {
122 # Ensure that the image has as a /var/spool/mail dir so shadow can
123 # put mailboxes there if the user reconfigures shadow to its
124 # defaults (see sed below).
125 install -d ${D}${localstatedir}/spool/mail
126
127 if [ -e ${WORKDIR}/pam.d ]; then
128 install -d ${D}${sysconfdir}/pam.d/
129 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
130 # Remove defaults that are not used when supporting PAM.
131 sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
132 fi
133
134 install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
135
136 # Move binaries to the locations we want
137 rm ${D}${sbindir}/vigr
138 ln -sf vipw.${BPN} ${D}${base_sbindir}/vigr
139 if [ "${sbindir}" != "${base_sbindir}" ]; then
140 mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw
141 fi
142 if [ "${bindir}" != "${base_bindir}" ]; then
143 mv ${D}${bindir}/login ${D}${base_bindir}/login
144 mv ${D}${bindir}/su ${D}${base_bindir}/su
145 fi
146
147 # Handle link properly after rename, otherwise missing files would
148 # lead rpm failed dependencies.
149 ln -sf newgrp.${BPN} ${D}${bindir}/sg
150}
151
152inherit update-alternatives
153
154ALTERNATIVE_PRIORITY = "200"
155
156ALTERNATIVE_${PN} = "passwd chfn newgrp chsh groups chpasswd login vipw vigr su"
157ALTERNATIVE_LINK_NAME[chpasswd] = "${sbindir}/chpasswd"
158ALTERNATIVE_LINK_NAME[login] = "${base_bindir}/login"
159ALTERNATIVE_LINK_NAME[vipw] = "${base_sbindir}/vipw"
160ALTERNATIVE_LINK_NAME[vigr] = "${base_sbindir}/vigr"
161ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
162
163ALTERNATIVE_${PN}-doc = "passwd.5 getspnam.3"
164ALTERNATIVE_LINK_NAME[passwd.5] = "${mandir}/man5/passwd.5"
165ALTERNATIVE_LINK_NAME[getspnam.3] = "${mandir}/man3/getspnam.3"
166
167pkg_postinst_${PN} () {
168 if [ "x$D" != "x" ]; then
169 rootarg="--root $D"
170 else
171 rootarg=""
172 fi
173
174 pwconv $rootarg || exit 1
175 grpconv $rootarg || exit 1
176}