From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B4488138334 for ; Sun, 21 Jul 2019 16:26:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A77A3E086A; Sun, 21 Jul 2019 16:26:41 +0000 (UTC) Received: from smtp.gentoo.org (mail.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 6E1B1E0866 for ; Sun, 21 Jul 2019 16:26:41 +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 633D73483E7 for ; Sun, 21 Jul 2019 16:26:40 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7E002731 for ; Sun, 21 Jul 2019 16:26:37 +0000 (UTC) From: "Thomas Deutschmann" 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" Message-ID: <1563724071.046b5c0b55e092e658ec0d3fd7971c326df7afa0.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_determineargs.sh gen_funcs.sh genkernel X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 046b5c0b55e092e658ec0d3fd7971c326df7afa0 X-VCS-Branch: master Date: Sun, 21 Jul 2019 16:26:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b67f1949-0a31-4d97-b96d-c56b6c99188a X-Archives-Hash: 2fd0f4653c2f38bb45db15944788b0ac commit: 046b5c0b55e092e658ec0d3fd7971c326df7afa0 Author: Thomas Deutschmann gentoo org> AuthorDate: Sat Jul 20 21:17:53 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Sun Jul 21 15:47:51 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=046b5c0b genkernel: Move $LOGFILE initialization to determine_real_args() Signed-off-by: Thomas Deutschmann gentoo.org> gen_determineargs.sh | 24 ++++++++++++++++++++++++ gen_funcs.sh | 9 --------- genkernel | 3 --- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gen_determineargs.sh b/gen_determineargs.sh index d39412c..72741fc 100755 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -188,6 +188,30 @@ determine_real_args() { set_config_with_override BOOL INSTALL CMD_INSTALL "yes" set_config_with_override BOOL CLEANUP CMD_CLEANUP "yes" + local can_write_log=no + if [ -w "${LOGFILE}" ] + then + can_write_log=yes + elif [ -w "$(dirname "${LOGFILE}")" ] + then + can_write_log=yes + fi + + if ! isTrue "${can_write_log}" + then + small_die "Cannot write to '${LOGFILE}'!" + fi + + if [ -f "${LOGFILE}" ] + then + # Truncate existing logfile + echo > "${LOGFILE}" 2>/dev/null || small_die "Could not write to '${LOGFILE}'!" + else + touch "${LOGFILE}" || small_die "Failed to create '${LOGFILE}'!" + fi + + dump_debugcache + if [ ! -d "${TMPDIR}" ] then mkdir -p "${TMPDIR}" || gen_die "Failed to create '${TMPDIR}'!" diff --git a/gen_funcs.sh b/gen_funcs.sh index 5681d0d..de8cd7f 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -264,15 +264,6 @@ cache_replace() { var_replace "CACHE" "${GK_V_CACHEDIR}" "${1}" } -start_log() { - if [ -f "${LOGFILE}" ] - then - (echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to '${LOGFILE}'." - fi - - dump_debugcache -} - gen_die() { set +x diff --git a/genkernel b/genkernel index 8991e69..50de3f7 100755 --- a/genkernel +++ b/genkernel @@ -95,7 +95,6 @@ then exit 1 fi -start_log NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}${NORMAL}" print_info 1 "Using genkernel configuration from '${_GENKERNEL_CONF}' ..." unset _GENKERNEL_CONF @@ -161,8 +160,6 @@ setup_cache_dir check_distfiles -dump_debugcache - KERNCACHE_IS_VALID="no" if [ -n "${KERNCACHE}" ] then