From nobody Fri May 03 07:47:27 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VW2vg3t5Mz5JWSk; Fri, 3 May 2024 07:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VW2vg3GWtz4JxM; Fri, 3 May 2024 07:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714722447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o1fsrECeWw1J25SMbHXJ6fmbf+OTRZmaW0n672IY+Qs=; b=QoQvMNSmZqr8Jn9A1xsgwwR7+SlkyejB8FGO+nhHIQHV+MwA81Q+nJyncWy3IamKqHXLFm WxMjXB2Q5nMjfMIkDPm6lrp3EEX+Z4Deuvsl6ZAAn4wMEDoxcdNqWlgHBixXZQYCffOAsr ixm+DEctW7v1w1NBhuCfHlX4oMeKKXe3cmebsmzaZkMV81irsEDyLM7gEEfsbmsKTiAgzH JH/Ztg9skHlKu0WcAZojy7cjVrbRO4vsxHWcMn9Ia9h1GFj62V4o0TyMSncPOxu3nnorM1 DT7uhU+89loOipDyN5kog/en8rP8FnDFFey9EtV/83J7CNWJ8p4XUhx/yVhvPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714722447; a=rsa-sha256; cv=none; b=MJa63FLORFBumO0JC0RhssCZIRitsqjUKdHCCEifxd2FK+WTwB4JrH0hi9N1q8LCPFP6DU 1BfVYkVoS3i+Ky3I0X0T37gEXmn/izxFIDOMVo+d4r+ljgBQKCpyl930udBkODsBH4bDB1 6UyyPrT2n/IacpJAXvuB4PuUDymLysSDCiN2GOKlFEGOf5u5WoIdcMJk+ETl0SejuP9db+ dNUPHzeA8h1FsvYmy42SYwziGvh4hs9k4tNUbaZ5l6Dh8y87l818bYS55FvSbfUsOYKRsh Iz8gDKacNI2pK8bHhtOzYAFRlARmiR0L68epI8zBzKBjIo+C8nEnhfEnMdCZSw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714722447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o1fsrECeWw1J25SMbHXJ6fmbf+OTRZmaW0n672IY+Qs=; b=QkRwq3CrTDStFLd4+vdHkN+9cSH2S3ngwOQfRGPWZRr8JkfiYiNC8ScwDlKf9n7+ixw5Hp Ja7aXRI7bww+qmTa1pjsMkZiSb/z/BC3o7ltiIUnBq3FrwlAYFXgnL8MdkofxAgzEArIt5 FzVjejif1gYQEdDtzqFkWx130ymmumingXz8UB7UEc40nB0TdytsPzmkZdPfb6xQKnusLp JywHfct6rMAoEJlPBjurQ3kBrgRwkN99fjue8yWW3HIlA3Y5PQiwkFqPZ4nwUGPzr0xqSh uxlSvbDgdiFyPUZx9b2TxZrRVv8D9eN6+GwKgCQs9GJx5wvYnbe/kzlW/MLBFQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VW2vg2lTMzdLv; Fri, 3 May 2024 07:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4437lRUM041519; Fri, 3 May 2024 07:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4437lR1P041516; Fri, 3 May 2024 07:47:27 GMT (envelope-from git) Date: Fri, 3 May 2024 07:47:27 GMT Message-Id: <202405030747.4437lR1P041516@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Michael Osipov Subject: git: 4280a82efe69 - main - Mk/Scripts/do-users-groups.sh: Make users and groups creation fail-fast List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: michaelo X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4280a82efe69f5dc77a67394f7bd36095c74cd6c Auto-Submitted: auto-generated The branch main has been updated by michaelo: URL: https://cgit.FreeBSD.org/ports/commit/?id=4280a82efe69f5dc77a67394f7bd36095c74cd6c commit 4280a82efe69f5dc77a67394f7bd36095c74cd6c Author: Michael Osipov AuthorDate: 2023-11-22 11:30:32 +0000 Commit: Michael Osipov CommitDate: 2024-05-03 07:44:53 +0000 Mk/Scripts/do-users-groups.sh: Make users and groups creation fail-fast Fail fast when pw(8) fails to create a user or a group. Especially when it is not the last command in the pre-install script then the exit code will be 0 and the failure will go unnoticed. PR: 267384 Approved by: jrm (mentor) Differential Revision: https://reviews.freebsd.org/D42719 --- Mk/Scripts/do-users-groups.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mk/Scripts/do-users-groups.sh b/Mk/Scripts/do-users-groups.sh index b4ddf5a8a5d3..fdaad401de72 100644 --- a/Mk/Scripts/do-users-groups.sh +++ b/Mk/Scripts/do-users-groups.sh @@ -76,7 +76,7 @@ if [ -n "${GROUPS}" ]; then cat >> "${dp_UG_INSTALL}" <<-eot2 if ! \${PW} groupshow $group >/dev/null 2>&1; then echo "Creating group '$group' with gid '$gid'" - \${PW} groupadd $group -g $gid + \${PW} groupadd $group -g $gid || exit \$? else echo "Using existing group '$group'" fi @@ -129,7 +129,7 @@ if [ -n "${USERS}" ]; then cat >> "${dp_UG_INSTALL}" <<-eot2 if ! \${PW} usershow $login >/dev/null 2>&1; then echo "Creating user '$login' with uid '$uid'" - \${PW} useradd $login -u $uid -g $gid $class -c "$gecos" -d $homedir -s $shell + \${PW} useradd $login -u $uid -g $gid $class -c "$gecos" -d $homedir -s $shell || exit \$? else echo "Using existing user '$login'" fi @@ -185,7 +185,7 @@ if [ -n "${GROUPS}" ]; then cat >> "${dp_UG_INSTALL}" <<-eot2 if ! \${PW} groupshow ${group} | grep -qw ${login}; then echo "Adding user '${login}' to group '${group}'" - \${PW} groupmod ${group} -m ${login} + \${PW} groupmod ${group} -m ${login} || exit \$? fi eot2 fi