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 B2CBE138334 for ; Fri, 26 Jul 2019 16:31:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A8F64E0815; Fri, 26 Jul 2019 16:31:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 8E3FFE0815 for ; Fri, 26 Jul 2019 16:31:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 E3222348C18 for ; Fri, 26 Jul 2019 16:31:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 94545720 for ; Fri, 26 Jul 2019 16:31:28 +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: <1564157718.df7d41f1e2fd5056a06418bb379e351b52424b3d.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_funcs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: df7d41f1e2fd5056a06418bb379e351b52424b3d X-VCS-Branch: master Date: Fri, 26 Jul 2019 16:31:28 +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: 3b98197c-e1f9-4737-8cb1-ca26224ada45 X-Archives-Hash: 04790663cfa84debffe806ed294cadbe commit: df7d41f1e2fd5056a06418bb379e351b52424b3d Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Jul 26 16:15:18 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Fri Jul 26 16:15:18 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=df7d41f1 gen_funcs.sh: Add is_gzipped() function Signed-off-by: Thomas Deutschmann gentoo.org> gen_funcs.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gen_funcs.sh b/gen_funcs.sh index 97a85dd..a1a3cf6 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -209,6 +209,32 @@ can_run_programs_compiled_by_genkernel() { echo "${can_run_programs}" } +is_gzipped() { + [[ ${#} -ne 1 ]] \ + && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!" + + local file_to_check=${1} + + if [ ! -f "${file_to_check}" ] + then + gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid usage of ${FUNCNAME}(): File '${file_to_check}' does not exist!" + fi + + local file_is_gzipped=no + local file_mimetype=$(file --brief --mime-type "${file_to_check}" 2>/dev/null) + + case "${file_mimetype}" in + application/x-gzip) + file_is_gzipped=yes + ;; + application/gzip) + file_is_gzipped=yes + ;; + esac + + echo "${file_is_gzipped}" +} + is_valid_ssh_host_keys_parameter_value() { local parameter_value=${1}