github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/test-install-script (about)

     1  #!/bin/bash
     2  # This script is used for testing install.sh and that it works for
     3  # each of component of our apt and yum repos
     4  set -e
     5  
     6  test_install_script(){
     7  	# these are equivalent to main, testing, experimental components
     8  	# in the repos, but its the url that will do the conversion
     9  	components=( experimental test get )
    10  
    11  	for component in "${components[@]}"; do
    12  		# change url to specific component for testing
    13  		local test_url=https://${component}.docker.com
    14  		local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
    15  		sed "s,url='https://get.docker.com/',url='${test_url}/'," hack/install.sh > "${script}"
    16  
    17  		chmod +x "${script}"
    18  
    19  		# test for each Dockerfile in contrib/builder
    20  		for dir in contrib/builder/*/*/; do
    21  			local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
    22  
    23  			echo "running install.sh for ${component} with ${from}"
    24  			docker run --rm -i -v ${script}:/install.sh ${from} /install.sh
    25  		done
    26  
    27  		rm -f ${script}
    28  	done
    29  }
    30  
    31  test_install_script