overlay sys-apps/baselayout: Don't create empty /etc configs

There is a bug in coreos baselayout which wipes
/etc/{group,gshadow,passwd,shadow} when
reinstalling/removing/upgrading the baselayout package.

The deleted files are touched in staging area, so the package ships
empty configuration files, overwriting the original configs on the
system. Instead we move the touch to postinst, which only touches the
existing files (or creates them when they're nonexistent).
This commit is contained in:
Daniel Zatovic 2025-03-05 15:37:01 +01:00
parent 24d8122b96
commit 21bcf1aea2
2 changed files with 4 additions and 4 deletions

View File

@ -101,10 +101,6 @@ pkg_preinst() {
emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" LIBDIRS="${libdirs}" layout
SYSTEMD_JOURNAL_GID=${ACCT_GROUP_SYSTEMD_JOURNAL_ID:-190} ROOT_UID=0 ROOT_GID=0 CORE_UID=500 CORE_GID=500 DESTDIR=${D} "${ED}/usr/share/${PN}/dumb-tmpfiles-proc.sh" "${ED}/usr/lib/tmpfiles.d" || die
rm -f "${ED}/usr/share/${PN}/Makefile" "${ED}/usr/share/${PN}/dumb-tmpfiles-proc.sh" || die
# The default passwd/group files must exist for some ebuilds
touch "${ED}/etc/"{group,gshadow,passwd,shadow}
chmod 640 "${ED}/etc/"{gshadow,shadow}
}
pkg_postinst() {
@ -131,4 +127,8 @@ pkg_postinst() {
# symlinks.
mkdir -p "${ROOT}/oem"
fi
# The default passwd/group files must exist for some ebuilds
touch "${EROOT}/etc/"{group,gshadow,passwd,shadow}
chmod 640 "${EROOT}/etc/"{gshadow,shadow}
}