diff options
Diffstat (limited to 'meta/recipes-core/base-passwd/base-passwd_3.6.3.bb')
-rw-r--r-- | meta/recipes-core/base-passwd/base-passwd_3.6.3.bb | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.6.3.bb b/meta/recipes-core/base-passwd/base-passwd_3.6.3.bb new file mode 100644 index 0000000000..bf50b01fd5 --- /dev/null +++ b/meta/recipes-core/base-passwd/base-passwd_3.6.3.bb | |||
@@ -0,0 +1,125 @@ | |||
1 | SUMMARY = "Base system master password/group files" | ||
2 | DESCRIPTION = "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." | ||
3 | HOMEPAGE = "https://launchpad.net/base-passwd" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "GPL-2.0-only" | ||
6 | LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" | ||
7 | |||
8 | SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar.xz \ | ||
9 | file://0001-Add-a-shutdown-group.patch \ | ||
10 | file://0002-Use-bin-sh-instead-of-bin-bash-for-the-root-user.patch \ | ||
11 | file://0003-Remove-for-root-since-we-do-not-have-an-etc-shadow.patch \ | ||
12 | file://0004-Add-an-input-group-for-the-dev-input-devices.patch \ | ||
13 | file://0005-Add-kvm-group.patch \ | ||
14 | file://0007-Add-wheel-group.patch \ | ||
15 | file://0001-base-passwd-Add-the-sgx-group.patch \ | ||
16 | " | ||
17 | |||
18 | SRC_URI[sha256sum] = "83575327d8318a419caf2d543341215c046044073d1afec2acc0ac4d8095ff39" | ||
19 | |||
20 | # the package is taken from launchpad; that source is static and goes stale | ||
21 | # so we check the latest upstream from a directory that does get updated | ||
22 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/" | ||
23 | |||
24 | S = "${WORKDIR}/work" | ||
25 | |||
26 | PACKAGECONFIG = "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}" | ||
27 | PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux" | ||
28 | |||
29 | inherit autotools | ||
30 | |||
31 | EXTRA_OECONF += "--disable-debconf --disable-docs" | ||
32 | |||
33 | NOLOGIN ?= "${base_sbindir}/nologin" | ||
34 | |||
35 | do_install () { | ||
36 | install -d -m 755 ${D}${sbindir} | ||
37 | install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/ | ||
38 | install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8 | ||
39 | install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/ | ||
40 | install -p -m 644 ${S}/man/update-passwd.pl.8 \ | ||
41 | ${D}${mandir}/pl/man8/update-passwd.8 | ||
42 | gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/* | ||
43 | install -d -m 755 ${D}${datadir}/base-passwd | ||
44 | install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/ | ||
45 | sed -i 's#:/root:#:${ROOT_HOME}:#' ${D}${datadir}/base-passwd/passwd.master | ||
46 | sed -i 's#/usr/sbin/nologin#${NOLOGIN}#' ${D}${datadir}/base-passwd/passwd.master | ||
47 | install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/ | ||
48 | |||
49 | install -d -m 755 ${D}${docdir}/${BPN} | ||
50 | install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPN}/ | ||
51 | gzip -9 ${D}${docdir}/${BPN}/* | ||
52 | install -p -m 644 ${S}/README ${D}${docdir}/${BPN}/ | ||
53 | install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/ | ||
54 | } | ||
55 | |||
56 | basepasswd_sysroot_postinst() { | ||
57 | #!/bin/sh -e | ||
58 | |||
59 | # Install passwd.master and group.master to sysconfdir | ||
60 | install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir} | ||
61 | for i in passwd group; do | ||
62 | install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/\$i.master \ | ||
63 | ${STAGING_DIR_TARGET}${sysconfdir}/\$i | ||
64 | done | ||
65 | |||
66 | # Run any useradd postinsts | ||
67 | for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do | ||
68 | if [ -f \$script ]; then | ||
69 | \$script | ||
70 | fi | ||
71 | done | ||
72 | } | ||
73 | |||
74 | SYSROOT_DIRS += "${sysconfdir}" | ||
75 | SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot" | ||
76 | |||
77 | base_passwd_tweaksysroot () { | ||
78 | mkdir -p ${SYSROOT_DESTDIR}${bindir} | ||
79 | dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN} | ||
80 | echo "${basepasswd_sysroot_postinst}" > $dest | ||
81 | chmod 0755 $dest | ||
82 | } | ||
83 | |||
84 | python populate_packages:prepend() { | ||
85 | # Add in the preinst function for ${PN} | ||
86 | # We have to do this here as prior to this, passwd/group.master | ||
87 | # would be unavailable. We need to create these files at preinst | ||
88 | # time before the files from the package may be available, hence | ||
89 | # storing the data from the files in the preinst directly. | ||
90 | |||
91 | f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r') | ||
92 | passwd = "".join(f.readlines()) | ||
93 | f.close() | ||
94 | f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r') | ||
95 | group = "".join(f.readlines()) | ||
96 | f.close() | ||
97 | |||
98 | preinst = """#!/bin/sh | ||
99 | mkdir -p $D${sysconfdir} | ||
100 | if [ ! -e $D${sysconfdir}/passwd ]; then | ||
101 | \tcat << 'EOF' > $D${sysconfdir}/passwd | ||
102 | """ + passwd + """EOF | ||
103 | fi | ||
104 | if [ ! -e $D${sysconfdir}/group ]; then | ||
105 | \tcat << 'EOF' > $D${sysconfdir}/group | ||
106 | """ + group + """EOF | ||
107 | fi | ||
108 | """ | ||
109 | d.setVar(d.expand('pkg_preinst:${PN}'), preinst) | ||
110 | } | ||
111 | |||
112 | addtask do_package after do_populate_sysroot | ||
113 | |||
114 | ALLOW_EMPTY:${PN} = "1" | ||
115 | |||
116 | PACKAGES =+ "${PN}-update" | ||
117 | FILES:${PN}-update = "${sbindir}/* ${datadir}/${PN}" | ||
118 | |||
119 | pkg_postinst:${PN}-update () { | ||
120 | #!/bin/sh | ||
121 | if [ -n "$D" ]; then | ||
122 | exit 0 | ||
123 | fi | ||
124 | ${sbindir}/update-passwd | ||
125 | } | ||