diff --git a/scripts/update_apt_package_in_package_list.sh b/scripts/update_apt_package_in_package_list.sh index 671861138..e9e82e751 100644 --- a/scripts/update_apt_package_in_package_list.sh +++ b/scripts/update_apt_package_in_package_list.sh @@ -4,10 +4,12 @@ set -o nounset set -o pipefail LIST_NEWEST_VERSION_OUTPUT=$1 # Package|Installed|Candidate -FLAVOR=$2 +SEARCH_DIRECTORY=$2 +REPLACE=$3 + PACKAGE=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 1 -d "|") CANDIDATE_VERSION=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 3 -d "|") -REPLACE=$3 +CURRENT_VERSION=$(echo "$LIST_NEWEST_VERSION_OUTPUT" | cut -f 2 -d "|") if [[ "$REPLACE" == "yes" ]] then @@ -15,7 +17,7 @@ then else SED_REPLACE_OPTION=() fi -grep -E -R "^$PACKAGE\|" "$FLAVOR" \ +grep -E -R "^$PACKAGE\|$CURRENT_VERSION" "$SEARCH_DIRECTORY" \ | cut -f 1 -d ":" \ - | xargs -I{} sed "${SED_REPLACE_OPTION=[@]}" -E "s/^($PACKAGE)\|.*$/$PACKAGE|$CANDIDATE_VERSION/g" "{}" \ + | xargs -I{} sed "${SED_REPLACE_OPTION[@]}" -E "s/^($PACKAGE\|$CURRENT_VERSION).*$/$PACKAGE|$CANDIDATE_VERSION/g" "{}" \ | grep -E "^$PACKAGE\|"