def populate_packages(d): # Add in the preinst function for ${PN} # We have to do this here as prior to this, passwd/group.master # would be unavailable. We need to create these files at preinst # time before the files from the package may be available, hence # storing the data from the files in the preinst directly. f = open(d.expand("${STAGING_DATADIR}/base-passwd/passwd.master"), 'r') passwd = "".join(f.readlines()) f.close() f = open(d.expand("${STAGING_DATADIR}/base-passwd/group.master"), 'r') group = "".join(f.readlines()) f.close() preinst = """#!/bin/sh mkdir -p $D${sysconfdir} if [ ! -e $D${sysconfdir}/passwd ]; then \tcat << 'EOF' > $D${sysconfdir}/passwd """ + passwd + """EOF fi if [ ! -e $D${sysconfdir}/group ]; then \tcat << 'EOF' > $D${sysconfdir}/group """ + group + """EOF fi """ d.setVar(d.expand('pkg_preinst:${PN}'), preinst) oe.package.populate_packages(d) populate_packages(d)