Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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." |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | HOMEPAGE = "https://launchpad.net/base-passwd" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 4 | SECTION = "base" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 5 | LICENSE = "GPLv2" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" |
| 7 | |
| 8 | RECIPE_NO_UPDATE_REASON = "Version 3.5.38 requires cdebconf for update-passwd utility" |
| 9 | |
| 10 | SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar.gz \ |
| 11 | file://add_shutdown.patch \ |
| 12 | file://nobash.patch \ |
| 13 | file://noshadow.patch \ |
| 14 | file://input.patch \ |
| 15 | file://disable-docs.patch \ |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 16 | file://kvm.patch \ |
| 17 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 18 | |
| 19 | SRC_URI[md5sum] = "6beccac48083fe8ae5048acd062e5421" |
| 20 | SRC_URI[sha256sum] = "f0b66388b2c8e49c15692439d2bee63bcdd4bbbf7a782c7f64accc55986b6a36" |
| 21 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 22 | # the package is taken from launchpad; that source is static and goes stale |
| 23 | # so we check the latest upstream from a directory that does get updated |
| 24 | UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/" |
| 25 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | inherit autotools |
| 27 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | do_install () { |
| 29 | install -d -m 755 ${D}${sbindir} |
| 30 | install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/ |
| 31 | install -d -m 755 ${D}${mandir}/man8 ${D}${mandir}/pl/man8 |
| 32 | install -p -m 644 ${S}/man/update-passwd.8 ${D}${mandir}/man8/ |
| 33 | install -p -m 644 ${S}/man/update-passwd.pl.8 \ |
| 34 | ${D}${mandir}/pl/man8/update-passwd.8 |
| 35 | gzip -9 ${D}${mandir}/man8/* ${D}${mandir}/pl/man8/* |
| 36 | install -d -m 755 ${D}${datadir}/base-passwd |
| 37 | install -o root -g root -p -m 644 ${S}/passwd.master ${D}${datadir}/base-passwd/ |
| 38 | sed -i 's#:/root:#:${ROOT_HOME}:#' ${D}${datadir}/base-passwd/passwd.master |
| 39 | install -o root -g root -p -m 644 ${S}/group.master ${D}${datadir}/base-passwd/ |
| 40 | |
| 41 | install -d -m 755 ${D}${docdir}/${BPN} |
| 42 | install -p -m 644 ${S}/debian/changelog ${D}${docdir}/${BPN}/ |
| 43 | gzip -9 ${D}${docdir}/${BPN}/* |
| 44 | install -p -m 644 ${S}/README ${D}${docdir}/${BPN}/ |
| 45 | install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/ |
| 46 | } |
| 47 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 48 | basepasswd_sysroot_postinst() { |
| 49 | #!/bin/sh |
| 50 | |
| 51 | # Install passwd.master and group.master to sysconfdir |
| 52 | install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir} |
| 53 | for i in passwd group; do |
| 54 | install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/\$i.master \ |
| 55 | ${STAGING_DIR_TARGET}${sysconfdir}/\$i |
| 56 | done |
| 57 | |
| 58 | # Run any useradd postinsts |
| 59 | for script in ${STAGING_DIR_TARGET}${bindir}/postinst-useradd-*; do |
| 60 | if [ -f \$script ]; then |
| 61 | \$script |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 63 | done |
| 64 | } |
| 65 | |
| 66 | SYSROOT_DIRS += "${sysconfdir}" |
| 67 | SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot" |
| 68 | |
| 69 | base_passwd_tweaksysroot () { |
| 70 | mkdir -p ${SYSROOT_DESTDIR}${bindir} |
| 71 | dest=${SYSROOT_DESTDIR}${bindir}/postinst-${PN} |
| 72 | echo "${basepasswd_sysroot_postinst}" > $dest |
| 73 | chmod 0755 $dest |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | } |
| 75 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 76 | python populate_packages:prepend() { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 77 | # Add in the preinst function for ${PN} |
| 78 | # We have to do this here as prior to this, passwd/group.master |
| 79 | # would be unavailable. We need to create these files at preinst |
| 80 | # time before the files from the package may be available, hence |
| 81 | # storing the data from the files in the preinst directly. |
| 82 | |
| 83 | f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r') |
| 84 | passwd = "".join(f.readlines()) |
| 85 | f.close() |
| 86 | f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r') |
| 87 | group = "".join(f.readlines()) |
| 88 | f.close() |
| 89 | |
| 90 | preinst = """#!/bin/sh |
| 91 | mkdir -p $D${sysconfdir} |
| 92 | if [ ! -e $D${sysconfdir}/passwd ]; then |
| 93 | \tcat << 'EOF' > $D${sysconfdir}/passwd |
| 94 | """ + passwd + """EOF |
| 95 | fi |
| 96 | if [ ! -e $D${sysconfdir}/group ]; then |
| 97 | \tcat << 'EOF' > $D${sysconfdir}/group |
| 98 | """ + group + """EOF |
| 99 | fi |
| 100 | """ |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 101 | d.setVar(d.expand('pkg_preinst:${PN}'), preinst) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | addtask do_package after do_populate_sysroot |
| 105 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 106 | ALLOW_EMPTY:${PN} = "1" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 107 | |
| 108 | PACKAGES =+ "${PN}-update" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 109 | FILES:${PN}-update = "${sbindir}/* ${datadir}/${PN}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 110 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 111 | pkg_postinst:${PN}-update () { |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | #!/bin/sh |
| 113 | if [ -n "$D" ]; then |
| 114 | exit 0 |
| 115 | fi |
| 116 | ${sbindir}/update-passwd |
| 117 | } |