From 3db813eb32530a1c239ea5c46a7ac0cf06934d88 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 12 Jan 2023 16:21:12 +0100 Subject: [PATCH] profiles: Do not modify preexisting users Add an ebuild phase hook that runs when pkg_postinst is about to be executed. The hook sets up the environment for acct-user packages to avoid modifications of the preexisting users - these are provided by our baselayout and usermod can't change anything there anyway (it complains that the user is not in /etc/passwd). --- .../coreos-overlay/profiles/coreos/base/profile.bashrc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc index 559985a71e..dcb504e3f5 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc @@ -94,6 +94,16 @@ cros_pre_pkg_setup_sysroot_build_bin_dir() { PATH+=":${CROS_BUILD_BOARD_BIN}" } +# Avoid modifications of the preexisting users - these are provided by +# our baselayout and usermod can't change anything there anyway (it +# complains that the user is not in /etc/passwd). +cros_pre_pkg_postinst_no_modifications_of_users() { + if [[ "${CATEGORY}" != 'acct-user' ]]; then + return 0 + fi + export ACCT_USER_NO_MODIFY=x +} + # Source hooks for SLSA build provenance report generation source "${BASH_SOURCE[0]}.slsa-provenance"