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