From: Prarit Bhargava <pra...@redhat.com>

redhat: shellcheck cleanup

Some shellcheck cleanups.

Signed-off-by: Prarit Bhargava <pra...@redhat.com>

diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -114,7 +114,7 @@ cdate="$(LC_ALL=C date +"%a %b %d %Y")"
 cversion="[$RPMVERSION]";
 echo "* $cdate $cname $cversion" > "$clogf"
 
-git log --topo-order --no-merges -z $GIT_NOTES "$GIT_FORMAT" \
+git log --topo-order --no-merges -z "$GIT_NOTES" "$GIT_FORMAT" \
        ^"${UPSTREAM}" "$lasttag".. -- ':!/redhat/rhdocs' | "${0%/*}"/genlog.py 
>> "$clogf"
 
 if [ "$HIDE_REDHAT" = "1" ]; then
@@ -151,17 +151,17 @@ fi
 
 # during rh-dist-git genspec runs again and generates empty changelog
 # create empty file to avoid adding extra header to changelog
-LENGTH=$(grep "^-" $clogf | wc -l | awk '{print $1}')
+LENGTH=$(grep -c "^-" "$clogf" | awk '{print $1}')
 if [ "$LENGTH" = 0 ]; then
-       rm -f $clogf
-       touch $clogf
+       rm -f "$clogf"
+       touch "$clogf"
 fi
 
 cat "$clogf" "$SOURCES/$SPECCHANGELOG" > "$clogf.full"
 mv -f "$clogf.full" "$SOURCES/$SPECCHANGELOG"
 
 # genlog.py generates Resolves lines as well, strip these from RPM changelog
-cat "$SOURCES/$SPECCHANGELOG" | grep -v -e "^Resolves: " > $clogf.stripped
+grep -v -e "^Resolves: " "$SOURCES/$SPECCHANGELOG" > "$clogf".stripped
 
 test -f "$SOURCES/$SPECFILE" &&
        sed -i -e "
diff --git a/redhat/scripts/create-tarball.sh b/redhat/scripts/create-tarball.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/create-tarball.sh
+++ b/redhat/scripts/create-tarball.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+# shellcheck disable=SC2153
 [ "$SINGLE_TARBALL" -eq 1 ] && _GITID="$GITID" || _GITID="$MARKER"
 
 # shellcheck disable=SC1083
@@ -15,7 +16,7 @@ fi
 
 if [ -f "$TARBALL" ]; then
        TARID=$(xzcat -qq "$TARBALL" | git get-tar-commit-id 2>/dev/null)
-       if [ "$_GITID" == "$TARID" ]; then
+       if [ "$_GITID" = "$TARID" ]; then
                echo "$(basename "$TARBALL") unchanged..."
                exit 0
        fi
diff --git a/redhat/scripts/rh-dist-git.sh b/redhat/scripts/rh-dist-git.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/rh-dist-git.sh
+++ b/redhat/scripts/rh-dist-git.sh
@@ -52,8 +52,8 @@ diff -X "$REDHAT"/git/dontdiff -upr "$tmpdir/$PACKAGE_NAME" 
"$REDHAT"/rpm/SOURCE
 # creating the changelog file
 
 # changelog has been created by genspec.sh, including Resolves line, just copy 
it here
-echo -e "${PACKAGE_NAME}-${RPMVERSION}\n" > $tmpdir/changelog
-awk '1;/^Resolves: /{exit};' $REDHAT/$SPECCHANGELOG >> $tmpdir/changelog
+echo -e "${PACKAGE_NAME}-${RPMVERSION}\n" > "$tmpdir"/changelog
+awk '1;/^Resolves: /{exit};' "$REDHAT"/"$SPECCHANGELOG" >> "$tmpdir"/changelog
 
 # all done
 echo "$tmpdir"
diff --git a/redhat/update_scripts.sh b/redhat/update_scripts.sh
index blahblah..blahblah 100755
--- a/redhat/update_scripts.sh
+++ b/redhat/update_scripts.sh
@@ -8,5 +8,5 @@ TARGET="$1"
 
 for i in "$RPM_SOURCE_DIR"/*."$TARGET"; do
        NEW=${i%.$TARGET}
-       cp "$i" $(basename "$NEW")
+       cp "$i" "$(basename "$NEW")"
 done

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1727
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure

Reply via email to