diff options
| -rw-r--r-- | meta/recipes-core/base-passwd/base-passwd_3.5.22.bb | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb index aa90a6d925..05be23f7e2 100644 --- a/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb +++ b/meta/recipes-core/base-passwd/base-passwd_3.5.22.bb | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | SUMMARY = "Base system master password/group files." | 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." | 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 | SECTION = "base" | 3 | SECTION = "base" |
| 4 | PR = "r4" | 4 | PR = "r5" |
| 5 | LICENSE = "GPLv2+" | 5 | LICENSE = "GPLv2+" |
| 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" | 6 | LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" |
| 7 | 7 | ||
| @@ -37,36 +37,6 @@ do_install () { | |||
| 37 | install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ | 37 | install -p -m 644 debian/copyright ${D}${docdir}/${BPN}/ |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | pkg_preinst_${PN} () { | ||
| 41 | set -e | ||
| 42 | |||
| 43 | # Used for rootfs generation. On in-target install this will be run | ||
| 44 | # before the unpack so the files won't be available | ||
| 45 | |||
| 46 | if [ ! -e $D${sysconfdir}/passwd ] && [ -e $D${datadir}/base-passwd/passwd.master ]; then | ||
| 47 | cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd | ||
| 48 | fi | ||
| 49 | |||
| 50 | if [ ! -e $D${sysconfdir}/group ] && [ -e $D${datadir}/base-passwd/group.master ]; then | ||
| 51 | cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group | ||
| 52 | fi | ||
| 53 | |||
| 54 | exit 0 | ||
| 55 | } | ||
| 56 | |||
| 57 | pkg_postinst_${PN} () { | ||
| 58 | set -e | ||
| 59 | |||
| 60 | if [ ! -e $D${sysconfdir}/passwd ] ; then | ||
| 61 | cp $D${datadir}/base-passwd/passwd.master $D${sysconfdir}/passwd | ||
| 62 | fi | ||
| 63 | |||
| 64 | if [ ! -e $D${sysconfdir}/group ] ; then | ||
| 65 | cp $D${datadir}/base-passwd/group.master $D${sysconfdir}/group | ||
| 66 | fi | ||
| 67 | exit 0 | ||
| 68 | } | ||
| 69 | |||
| 70 | base_passwd_sstate_postinst() { | 40 | base_passwd_sstate_postinst() { |
| 71 | if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] | 41 | if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] |
| 72 | then | 42 | then |
| @@ -80,3 +50,31 @@ base_passwd_sstate_postinst() { | |||
| 80 | install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/group.master ${STAGING_DIR_TARGET}${sysconfdir}/group | 50 | install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/group.master ${STAGING_DIR_TARGET}${sysconfdir}/group |
| 81 | fi | 51 | fi |
| 82 | } | 52 | } |
| 53 | |||
| 54 | python 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(bb.data.expand("${STAGING_DATADIR}/base-passwd/passwd.master", d), 'r') | ||
| 62 | passwd = "".join(f.readlines()) | ||
| 63 | f.close() | ||
| 64 | f = open(bb.data.expand("${STAGING_DATADIR}/base-passwd/group.master", d), 'r') | ||
| 65 | group = "".join(f.readlines()) | ||
| 66 | f.close() | ||
| 67 | |||
| 68 | preinst = """#!/bin/sh | ||
| 69 | if [ ! -e $D${sysconfdir}/passwd ]; then | ||
| 70 | cat << EOF > $D${sysconfdir}/passwd | ||
| 71 | """ + passwd + """EOF | ||
| 72 | fi | ||
| 73 | if [ ! -e $D${sysconfdir}/group ]; then | ||
| 74 | cat << EOF > $D${sysconfdir}/group | ||
| 75 | """ + group + """EOF | ||
| 76 | fi | ||
| 77 | """ | ||
| 78 | d.setVar('pkg_preinst_${PN}', preinst) | ||
| 79 | } | ||
| 80 | |||
