From fccd77e53c816006e3b0510772143ddbb0ee0458 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Mon, 8 Apr 2024 15:51:00 -0300 Subject: [PATCH] Fix shellcheck --- libexec/portzap/git-changed-files | 10 +++++----- libexec/portzap/git-removed-files | 4 ++-- libexec/portzap/git-rev | 2 +- libexec/portzap/portzap-install | 8 ++++---- libexec/portzap/portzap-setup | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libexec/portzap/git-changed-files b/libexec/portzap/git-changed-files index afbc658..f00bec5 100644 --- a/libexec/portzap/git-changed-files +++ b/libexec/portzap/git-changed-files @@ -7,8 +7,8 @@ commit=$2 ## # main -cd ${gitdir} -add=$(git diff --name-only --diff-filter=A ${commit} HEAD) -mod=$(git diff --name-only --diff-filter=M ${commit} HEAD) -echo ${add} -echo ${mod} +cd "${gitdir}" +add=$(git diff --name-only --diff-filter=A "${commit}" HEAD) +mod=$(git diff --name-only --diff-filter=M "${commit}" HEAD) +echo "${add}" +echo "${mod}" diff --git a/libexec/portzap/git-removed-files b/libexec/portzap/git-removed-files index 48219c1..1190ebb 100644 --- a/libexec/portzap/git-removed-files +++ b/libexec/portzap/git-removed-files @@ -7,5 +7,5 @@ commit=$2 ## # main -cd ${gitdir} -git diff --name-only --diff-filter=D ${commit} HEAD +cd "${gitdir}" +git diff --name-only --diff-filter=D "${commit}" HEAD diff --git a/libexec/portzap/git-rev b/libexec/portzap/git-rev index a5cf25a..4f94ab8 100644 --- a/libexec/portzap/git-rev +++ b/libexec/portzap/git-rev @@ -6,5 +6,5 @@ gitdir=$1 ## # main -cd ${gitdir} +cd "${gitdir}" git rev-parse HEAD diff --git a/libexec/portzap/portzap-install b/libexec/portzap/portzap-install index 06f4990..baff225 100755 --- a/libexec/portzap/portzap-install +++ b/libexec/portzap/portzap-install @@ -23,8 +23,8 @@ perform_update() for file in ${add}; do target="${installdir}/${file}" parent=$(dirname "${target}") - if [ ! -e ${parent} ]; then - mkdir -p ${parent} + if [ ! -e "${parent}" ]; then + mkdir -p "${parent}" fi cp "${file}" "${target}" chown root:_portzap "${target}" @@ -39,7 +39,7 @@ perform_install() -exec cp -Rfv {} "${installdir}" \; \ -exec chown -R root:_portzap "${installdir}/{}" \; for path in ${artifacts}; do - rm -rf "${installdir}/${path}" + rm -rf "${installdir:?}/${path}" done } @@ -52,4 +52,4 @@ if [ -e "${revfile}" ]; then else perform_install fi -echo $(doas -u _portzap ${libexec}/git-rev ${gitdir}) > ${revfile} +doas -u _portzap ${libexec}/git-rev "${gitdir}" > "${revfile}" diff --git a/libexec/portzap/portzap-setup b/libexec/portzap/portzap-setup index b453d01..04b6516 100755 --- a/libexec/portzap/portzap-setup +++ b/libexec/portzap/portzap-setup @@ -16,7 +16,7 @@ if ! id -u _portzap > /dev/null 2>&1; then echo "[ok] add _portzap user, group and home directory" fi -if ! fgrep "${conf}" "${doas}" > /dev/null 2>&1; then +if ! grep -F "${conf}" "${doas}" > /dev/null 2>&1; then echo "${conf}" >> "${doas}" echo "[ok] update ${doas}" fi