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 DBFC1138334 for ; Wed, 7 Aug 2019 15:46:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 23FACE08C9; Wed, 7 Aug 2019 15:46:14 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 F3260E08BB for ; Wed, 7 Aug 2019 15:46:13 +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 0EDC03494B9 for ; Wed, 7 Aug 2019 15:46:13 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3903D760 for ; Wed, 7 Aug 2019 15:46:10 +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: <1565124032.a1f719112f02feb8e7c854a5095c7cebb6d0bf4a.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/login-remote.sh X-VCS-Directories: defaults/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: a1f719112f02feb8e7c854a5095c7cebb6d0bf4a X-VCS-Branch: master Date: Wed, 7 Aug 2019 15:46:10 +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: 00bf621c-7052-41ed-973a-9cf00da43715 X-Archives-Hash: d12f43a1147799d98f82af16e951ca85 commit: a1f719112f02feb8e7c854a5095c7cebb6d0bf4a Author: Thomas Deutschmann gentoo org> AuthorDate: Tue Aug 6 17:17:20 2019 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Tue Aug 6 20:40:32 2019 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=a1f71911 login-remote.sh: Make shellcheck happy Signed-off-by: Thomas Deutschmann gentoo.org> defaults/login-remote.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/defaults/login-remote.sh b/defaults/login-remote.sh index ca85b06..12596b9 100644 --- a/defaults/login-remote.sh +++ b/defaults/login-remote.sh @@ -15,31 +15,31 @@ receivefile() { swap) file=${CRYPT_KEYFILE_SWAP} ;; + '') + bad_msg "No keyfile specified." "${CRYPT_SILENT}" + exit 1 + ;; *) - bad_msg "Unknown '${1}' keyfile received." ${CRYPT_SILENT} + bad_msg "Unknown '${1}' keyfile received." "${CRYPT_SILENT}" exit 1 ;; esac # limit maximum stored bytes to 1M to avoid killing the server - dd of=${file} count=1k bs=1k 2>/dev/null + run dd of="${file}" count=1k bs=1k 2>/dev/null return $? } - - if [ "x${1}" = "x-c" ] then - command=$(echo ${2} | awk -F" " '{print $1}') - type=$(echo ${2} | awk -F" " '{print $2}') + command=$(echo "${2}" | awk '{ print $1 }') + type=$(echo "${2}" | awk '{ print $2 }') case ${command} in post) - receivefile ${type} - if [ $? -eq 0 ] + if receivefile "${type}" then - unlock-luks ${type} - if [ $? -eq 0 ] + if unlock-luks "${type}" then if [ "${type}" = 'root' ] then @@ -53,12 +53,12 @@ then exit 1 fi else - bad_msg "Keyfile was not properly received!" ${CRYPT_SILENT} + bad_msg "Keyfile was not properly received!" "${CRYPT_SILENT}" exit 1 fi ;; *) - bad_msg "Command '${command}' is not supported!" ${CRYPT_SILENT} + bad_msg "Command '${command}' is not supported!" "${CRYPT_SILENT}" exit 1 esac else @@ -77,12 +77,12 @@ else good_msg "${NORMAL}Be aware that it will kill your connection which means" good_msg "${NORMAL}you will no longer be able to work in this shell." - if [ -n "${CRYPT_ROOT}" -a ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] + if [ -n "${CRYPT_ROOT}" ] && [ ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] then good_msg "${NORMAL}To remote unlock LUKS-encrypted root device, run '${BOLD}unlock-luks root${NORMAL}'." fi - if [ -n "${CRYPT_SWAP}" -a ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] + if [ -n "${CRYPT_SWAP}" ] && [ ! -f "${CRYPT_ROOT_OPENED_LOCKFILE}" ] then good_msg "${NORMAL}To remote unlock LUKS-encrypted swap device, run '${BOLD}unlock-luks swap${NORMAL}'." fi