summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/shadow/shadow.inc
diff options
context:
space:
mode:
authorScott Garman <scott.a.garman@intel.com>2011-06-03 10:33:09 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-06 15:58:41 +0100
commit109aa5c860fa5ba453e2add8fc18096774a40e39 (patch)
tree8424f57a7688746a4c954ecd927cf06fe0471059 /meta/recipes-extended/shadow/shadow.inc
parent1b817aa64a16ee9b6f13dc090a8c332e6afc9215 (diff)
downloadpoky-109aa5c860fa5ba453e2add8fc18096774a40e39.tar.gz
shadow: recipe and patch cleanup
Taking over maintenance of the shadow recipe. Cleaning it up in preparation of adding a -native version that will be used to add users/groups during preinstall. (From OE-Core rev: 254ca8c1667b8d35914555714239a09bfb4f43be) Signed-off-by: Scott Garman <scott.a.garman@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/shadow/shadow.inc')
-rw-r--r--meta/recipes-extended/shadow/shadow.inc123
1 files changed, 0 insertions, 123 deletions
diff --git a/meta/recipes-extended/shadow/shadow.inc b/meta/recipes-extended/shadow/shadow.inc
deleted file mode 100644
index 35bd6a881b..0000000000
--- a/meta/recipes-extended/shadow/shadow.inc
+++ /dev/null
@@ -1,123 +0,0 @@
1DESCRIPTION = "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"
6LIC_FILES_CHKSUM = "file://COPYING;md5=08c553a87d4e51bbed50b20e0adcaede \
7 file://src/passwd.c;firstline=8;endline=30;md5=2899a045e90511d0e043b85a7db7e2fe"
8
9PR = "r1"
10
11PAM_PLUGINS = " libpam-runtime \
12 pam-plugin-faildelay \
13 pam-plugin-securetty \
14 pam-plugin-nologin \
15 pam-plugin-env \
16 pam-plugin-group \
17 pam-plugin-limits \
18 pam-plugin-lastlog \
19 pam-plugin-motd \
20 pam-plugin-mail \
21 pam-plugin-shells \
22 pam-plugin-rootok"
23
24DEPENDS = "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
25RDEPENDS_${PN} = "${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
26
27# since we deduce from ${SERIAL_CONSOLE}
28PACKAGE_ARCH = "${MACHINE_ARCH}"
29
30# Additional Policy files for PAM
31PAM_SRC_URI = "file://pam.d/chfn \
32 file://pam.d/chpasswd \
33 file://pam.d/chsh \
34 file://pam.d/login \
35 file://pam.d/newusers \
36 file://pam.d/passwd \
37 file://pam.d/su"
38
39SRC_URI = "ftp://pkg-shadow.alioth.debian.org/pub/pkg-shadow/shadow-${PV}.tar.bz2 \
40 file://login_defs_pam.sed \
41 ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
42 file://securetty"
43
44inherit autotools gettext
45
46EXTRA_OECONF += "--without-audit \
47 --without-libcrack \
48 ${@base_contains('DISTRO_FEATURES', 'pam', '--with-libpam', '--without-libpam', d)} \
49 --without-selinux"
50
51do_install_append() {
52 # Ensure that the image has as /var/spool/mail dir so shadow can put mailboxes there if the user
53 # reconfigures Shadow to default (see sed below).
54 install -d ${D}${localstatedir}/spool/mail
55
56 if [ -e ${WORKDIR}/pam.d ]; then
57 install -d ${D}${sysconfdir}/pam.d/
58 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
59 # Remove defaults that are not used when supporting PAM
60 sed -i -f ${WORKDIR}/login_defs_pam.sed ${D}${sysconfdir}/login.defs
61 fi
62
63 # Enable CREATE_HOME by default.
64 sed -i 's/#CREATE_HOME/CREATE_HOME/g' ${D}${sysconfdir}/login.defs
65
66 # As we are on an embedded system ensure the users mailbox is in ~/ not
67 # /var/spool/mail by default as who knows where or how big /var is.
68 # The system MDA will set this later anyway.
69 sed -i 's/MAIL_DIR/#MAIL_DIR/g' ${D}${sysconfdir}/login.defs
70 sed -i 's/#MAIL_FILE/MAIL_FILE/g' ${D}${sysconfdir}/login.defs
71
72 # disable checking emails at all
73 sed -i 's/MAIL_CHECK_ENAB/#MAIL_CHECK_ENAB/g' ${D}${sysconfdir}/login.defs
74
75 # now we don't have a mail system. disable mail creation for now
76 sed -i 's:/bin/bash:/bin/sh:g' ${D}${sysconfdir}/default/useradd
77 sed -i '/^CREATE_MAIL_SPOOL/ s:^:#:' ${D}${sysconfdir}/default/useradd
78
79 install -d ${D}${sbindir} ${D}${base_sbindir} ${D}${base_bindir}
80 for i in passwd chfn newgrp chsh ; do
81 mv ${D}${bindir}/$i ${D}${bindir}/$i.${PN}
82 done
83
84 mv ${D}${sbindir}/chpasswd ${D}${sbindir}/chpasswd.${PN}
85 mv ${D}${sbindir}/vigr ${D}${base_sbindir}/vigr.${PN}
86 mv ${D}${sbindir}/vipw ${D}${base_sbindir}/vipw.${PN}
87 mv ${D}${bindir}/login ${D}${base_bindir}/login.${PN}
88
89 # Ensure we add a suitable securetty file to the package that has most common embedded TTYs defined.
90 if [ ! -z "${SERIAL_CONSOLE}" ]; then
91 # our SERIAL_CONSOLE contains baud rate too and sometime -L option as well.
92 # the following pearl :) takes that and converts it into newline sepated tty's and appends
93 # them into securetty. So if a machine has a weird looking console device node (e.g. ttyAMA0) that securetty
94 # does not know then it will get appended to securetty and root login will be allowed on
95 # that console.
96 echo "${SERIAL_CONSOLE}" | sed -e 's/[0-9][0-9]\|\-L//g'|tr "[ ]" "[\n]" >> ${WORKDIR}/securetty
97 fi
98 install -m 0400 ${WORKDIR}/securetty ${D}${sysconfdir}/securetty
99}
100
101pkg_postinst_${PN} () {
102 update-alternatives --install ${bindir}/passwd passwd passwd.${PN} 200
103 update-alternatives --install ${sbindir}/chpasswd chpasswd chpasswd.${PN} 200
104 update-alternatives --install ${bindir}/chfn chfn chfn.${PN} 200
105 update-alternatives --install ${bindir}/newgrp newgrp newgrp.${PN} 200
106 update-alternatives --install ${bindir}/chsh chsh chsh.${PN} 200
107 update-alternatives --install ${base_bindir}/login login login.${PN} 200
108 update-alternatives --install ${base_sbindir}/vipw vipw vipw.${PN} 200
109 update-alternatives --install ${base_sbindir}/vigr vigr vigr.${PN} 200
110
111 if [ "x$D" != "x" ]; then
112 exit 1
113 fi
114
115 pwconv
116 grpconv
117}
118
119pkg_prerm_${PN} () {
120 for i in passwd chpasswd chfn newgrp chsh login vipw vigr ; do
121 update-alternatives --remove $i $i.${PN}
122 done
123}