summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/base-passwd/base-passwd_3.5.26.bb')
-rw-r--r--meta/recipes-core/base-passwd/base-passwd_3.5.26.bb95
1 files changed, 95 insertions, 0 deletions
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb
new file mode 100644
index 0000000000..4d94dcca65
--- /dev/null
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.26.bb
@@ -0,0 +1,95 @@
1SUMMARY = "Base system master password/group files."
2DESCRIPTION = "The master copies of the user database files (/etc/passwd and /etc/group). The update-passwd tool is also provided to keep the system databases synchronized with these master files."
3SECTION = "base"
4PR = "r2"
5LICENSE = "GPLv2+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a"
7
8SRC_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/base-passwd_${PV}.tar.gz \
9 file://add_shutdown.patch \
10 file://nobash.patch \
11 file://input.patch"
12
13SRC_URI[md5sum] = "74245e5c21dc74d9675c77cd8dfa02e6"
14SRC_URI[sha256sum] = "258a78317aa563143d10375c6e1e63a60898e503887f00fffd70b6b297c1b429"
15
16inherit autotools
17
18SSTATEPOSTINSTFUNCS += "base_passwd_sstate_postinst"
19
20do_install () {
21 install -d -m 755 ${D}${sbindir}
22 install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/
23 install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8
24 install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/
25 install -p -m 644 ${S}/man/update-passwd.pl.8 \
26 ${D}${mandir}/pl/man8/update-passwd.8
27 gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/*
28 install -d -m 755 ${D}${datadir}/base-passwd
29 sed -i 's#:/root:#:${ROOT_HOME}:#' ${S}/passwd.master
30 install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/
31 install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/
32
33 install -d -m 755 ${D}${docdir}/${BPN}
34 install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPN}/
35 gzip -9 ${D}${docdir}/${BPN}/*
36 install -p -m 644 ${S}/README ${D}${docdir}/${BPN}/
37 install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
38}
39
40base_passwd_sstate_postinst() {
41 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
42 then
43 # Staging does not copy ${sysconfdir} files into the
44 # target sysroot, so we need to do so manually. We
45 # put these files in the target sysroot so they can
46 # be used by recipes which use custom user/group
47 # permissions.
48 install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
49 install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/passwd.master ${STAGING_DIR_TARGET}${sysconfdir}/passwd
50 install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/group.master ${STAGING_DIR_TARGET}${sysconfdir}/group
51 fi
52}
53
54python populate_packages_prepend() {
55 # Add in the preinst function for ${PN}
56 # We have to do this here as prior to this, passwd/group.master
57 # would be unavailable. We need to create these files at preinst
58 # time before the files from the package may be available, hence
59 # storing the data from the files in the preinst directly.
60
61 f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r')
62 passwd = "".join(f.readlines())
63 f.close()
64 f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r')
65 group = "".join(f.readlines())
66 f.close()
67
68 preinst = """#!/bin/sh
69mkdir -p $D${sysconfdir}
70if [ ! -e $D${sysconfdir}/passwd ]; then
71\tcat << EOF > $D${sysconfdir}/passwd
72""" + passwd + """EOF
73fi
74if [ ! -e $D${sysconfdir}/group ]; then
75\tcat << EOF > $D${sysconfdir}/group
76""" + group + """EOF
77fi
78"""
79 d.setVar('pkg_preinst_${PN}', preinst)
80}
81
82addtask do_package after do_populate_sysroot
83
84ALLOW_EMPTY_${PN} = "1"
85
86PACKAGES =+ "${PN}-update"
87FILES_${PN}-update = "${sbindir}/* ${datadir}/${PN}"
88
89pkg_postinst_${PN}-update () {
90#!/bin/sh
91if [ -n "$D" ]; then
92 exit 0
93fi
94${sbindir}/update-passwd
95}