Skip to content

Commit

Permalink
rpm: fix usage of substr argument
Browse files Browse the repository at this point in the history
As we need to handle *whole string" as input, using $0 is correct.
(though as it doesn't contains separator, $0/$1 seems same for awk)

Signed-off-by: Kentaro Hayashi <[email protected]>
  • Loading branch information
kenhys committed Jul 29, 2024
1 parent a3aacfb commit 2a885c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions fluent-package/yum/binstubs-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if [ "$CI" = "true" ]; then
echo "::group::Setup binstubs test"
fi

distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f4)
distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f4)

ENABLE_UPGRADE_TEST=1
case ${distribution} in
Expand Down
4 changes: 2 additions & 2 deletions fluent-package/yum/confluent-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fi
# This means that column glitch exists.
# So, we should remove before "o" character.

distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f4)
distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f4)

case ${distribution} in
amazon)
Expand Down
4 changes: 2 additions & 2 deletions fluent-package/yum/install-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ set -exu
# This means that column glitch exists.
# So, we should remove before "o" character.

distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f4)
distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f4)

ENABLE_UPGRADE_TEST=1
case ${distribution} in
Expand Down
4 changes: 2 additions & 2 deletions fluent-package/yum/serverspec-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if [ "$CI" = "true" ]; then
echo "::group::Setup serverspec test"
fi

distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f4)
distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($0, "o"))}' | cut -d: -f4)

case ${distribution} in
amazon)
Expand Down
4 changes: 2 additions & 2 deletions fluent-package/yum/systemd-test/commonvar.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

distribution=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($0, index($1, "o"))}' | cut -d: -f4)
distribution=$(cat /etc/system-release-cpe | awk '{print substr($1, index($1, "o"))}' | cut -d: -f2)
version=$(cat /etc/system-release-cpe | awk '{print substr($1, index($1, "o"))}' | cut -d: -f4)
td_agent_version=4.5.2

case $distribution in
Expand Down

0 comments on commit 2a885c3

Please sign in to comment.