Skip to content

Commit ac63bbb

Browse files
committed
Fix inconsistent whitespace in apt-cache results
For some reason searching for some packages with apt-cache madison has a result with leading whitespaces while others do not have the leading whitespaces. Opting here to just remove all leading/trailing whitespaces when accounting for results to make it consistent. Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
1 parent 1558f8d commit ac63bbb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ do_install() {
357357
else
358358
# Will work for incomplete versions IE (17.12), but may not actually grab the "latest" if in the test channel
359359
pkg_pattern="$(echo "$VERSION" | sed "s/-ce-/~ce~.*/g" | sed "s/-/.*/g").*-0~$lsb_dist"
360-
search_command="apt-cache madison 'docker-ce' | grep '$pkg_pattern' | head -1 | cut -d' ' -f 4"
360+
search_command="apt-cache madison 'docker-ce' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3"
361361
pkg_version="$($sh_c "$search_command")"
362362
echo "INFO: Searching repository for VERSION '$VERSION'"
363363
echo "INFO: $search_command"
@@ -367,7 +367,7 @@ do_install() {
367367
echo
368368
exit 1
369369
fi
370-
search_command="apt-cache madison 'docker-ce-cli' | grep '$pkg_pattern' | head -1 | cut -d' ' -f 4"
370+
search_command="apt-cache madison 'docker-ce-cli' | grep '$pkg_pattern' | head -1 | awk '{\$1=\$1};1' | cut -d' ' -f 3"
371371
# Don't insert an = for cli_pkg_version, we'll just include it later
372372
cli_pkg_version="$($sh_c "$search_command")"
373373
pkg_version="=$pkg_version"

0 commit comments

Comments
 (0)