mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	add test script for built debs
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
		
							parent
							
								
									8369f00d30
								
							
						
					
					
						commit
						14e85c8c55
					
				
					 2 changed files with 59 additions and 0 deletions
				
			
		
							
								
								
									
										57
									
								
								hack/make/test-deb-install
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										57
									
								
								hack/make/test-deb-install
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,57 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
# This script is used for testing install.sh and that it works for
 | 
			
		||||
# each of component of our apt and yum repos
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
: ${DEB_DIR:="$(pwd)/bundles/$(cat VERSION)/build-deb"}
 | 
			
		||||
 | 
			
		||||
if [[ ! -d "${DEB_DIR}" ]]; then
 | 
			
		||||
	echo "you must first run `make deb` or hack/make/build-deb"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
test_deb_install(){
 | 
			
		||||
	# test for each Dockerfile in contrib/builder
 | 
			
		||||
	for dir in contrib/builder/deb/*/; do
 | 
			
		||||
		local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
 | 
			
		||||
		local dir=$(basename "$dir")
 | 
			
		||||
 | 
			
		||||
		if [[ ! -d "${DEB_DIR}/${dir}" ]]; then
 | 
			
		||||
			echo "No deb found for ${dir}"
 | 
			
		||||
			exit 1
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
 | 
			
		||||
		cat <<-EOF > "${script}"
 | 
			
		||||
		#!/bin/bash
 | 
			
		||||
		set -e
 | 
			
		||||
		set -x
 | 
			
		||||
 | 
			
		||||
		apt-get update && apt-get install -y apparmor
 | 
			
		||||
 | 
			
		||||
		dpkg -i /root/debs/*.deb || true
 | 
			
		||||
 | 
			
		||||
		apt-get install -yf
 | 
			
		||||
 | 
			
		||||
		/etc/init.d/apparmor start
 | 
			
		||||
 | 
			
		||||
		# this will do everything _except_ load the profile into the kernel
 | 
			
		||||
		(
 | 
			
		||||
		cd /etc/apparmor.d
 | 
			
		||||
		/sbin/apparmor_parser --skip-kernel-load docker-engine
 | 
			
		||||
		)
 | 
			
		||||
		EOF
 | 
			
		||||
 | 
			
		||||
		chmod +x "${script}"
 | 
			
		||||
 | 
			
		||||
		echo "testing deb install for ${from}"
 | 
			
		||||
		docker run --rm -i --privileged \
 | 
			
		||||
			-v ${DEB_DIR}/${dir}:/root/debs \
 | 
			
		||||
			-v ${script}:/install.sh \
 | 
			
		||||
			${from} /install.sh
 | 
			
		||||
 | 
			
		||||
		rm -f ${script}
 | 
			
		||||
	done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
test_deb_install
 | 
			
		||||
| 
						 | 
				
			
			@ -23,6 +23,8 @@ test_install_script(){
 | 
			
		|||
			echo "running install.sh for ${component} with ${from}"
 | 
			
		||||
			docker run --rm -i -v ${script}:/install.sh ${from} /install.sh
 | 
			
		||||
		done
 | 
			
		||||
 | 
			
		||||
		rm -f ${script}
 | 
			
		||||
	done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue