From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1192762-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id A7CE4138359
	for <garchives@archives.gentoo.org>; Sat,  1 Aug 2020 21:41:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E426DE0A92;
	Sat,  1 Aug 2020 21:41:55 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id CEF1BE0A92
	for <gentoo-commits@lists.gentoo.org>; Sat,  1 Aug 2020 21:41:55 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 0A4F534F4E8
	for <gentoo-commits@lists.gentoo.org>; Sat,  1 Aug 2020 21:41:54 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 25531308
	for <gentoo-commits@lists.gentoo.org>; Sat,  1 Aug 2020 21:41:48 +0000 (UTC)
From: "Thomas Deutschmann" <whissi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" <whissi@gentoo.org>
Message-ID: <1596314915.3cf52d4eacdde88edce23e96262d8870f65dccb8.whissi@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: genkernel
X-VCS-Directories: /
X-VCS-Committer: whissi
X-VCS-Committer-Name: Thomas Deutschmann
X-VCS-Revision: 3cf52d4eacdde88edce23e96262d8870f65dccb8
X-VCS-Branch: master
Date: Sat,  1 Aug 2020 21:41:48 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 90555324-a7b0-4689-a0d2-1df45f5cb1c2
X-Archives-Hash: 2e97e43919e58b4022be1015ba16216d

commit:     3cf52d4eacdde88edce23e96262d8870f65dccb8
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  1 18:58:14 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Aug  1 20:48:35 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=3cf52d4e

genkernel: Fail if we cannot save kernel config

Now that we check in determine_real_args() if we can write into /etc/kernels
or bail out early in case we cannot but --save-config was set, we can be
more explicit and fail now in case we failed to save kernel config.

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 genkernel | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/genkernel b/genkernel
index b601eb0..efa4360 100755
--- a/genkernel
+++ b/genkernel
@@ -263,10 +263,15 @@ then
 	if isTrue "${SAVE_CONFIG}"
 	then
 		print_info 1 "$(get_indent 1)>> Saving config of successful build to '/etc/kernels/${GK_FILENAME_CONFIG}' ..."
-		[ ! -e '/etc/kernels' ] && mkdir -p /etc/kernels
-		cp "${KERNEL_OUTPUTDIR}/.config" "/etc/kernels/${GK_FILENAME_CONFIG}" || \
-			print_warning 1 "Unable to copy the kernel configuration file; Ignoring non-fatal error ..."
-			# Just a warning because ordinary users are not allowed to write in /etc
+
+		if [ ! -d '/etc/kernels' ]
+		then
+			mkdir -p /etc/kernels \
+				|| gen_die "Failed to create '/etc/kernels'!"
+		fi
+
+		cp -aL "${KERNEL_OUTPUTDIR}/.config" "/etc/kernels/${GK_FILENAME_CONFIG}" \
+			|| gen_die "Failed to copy kernel configuration to '/etc/kernels'!"
 	fi
 elif [[ -n "${KERNEL_LOCALVERSION}" && "${KERNEL_LOCALVERSION}" != "${LOV}" ]]
 then