Browse code

add file to test install script

Signed-off-by: Jessica Frazelle <acidburn@docker.com>

Jessica Frazelle authored on 2015/07/31 08:20:57
Showing 3 changed files
... ...
@@ -2,8 +2,7 @@
2 2
 # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"!
3 3
 #
4 4
 
5
-FROM debian:wheezy
6
-RUN echo deb http://http.debian.net/debian wheezy-backports main > /etc/apt/sources.list.d/wheezy-backports.list
5
+FROM debian:wheezy-backports
7 6
 
8 7
 RUN apt-get update && apt-get install -y bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-systemd git libapparmor-dev libdevmapper-dev libsqlite3-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
9 8
 
... ...
@@ -22,6 +22,13 @@ for version in "${versions[@]}"; do
22 22
 	suite="${version##*-}"
23 23
 	from="${distro}:${suite}"
24 24
 
25
+	case "$from" in
26
+		debian:wheezy)
27
+			# add -backports, like our users have to
28
+			from+='-backports'
29
+			;;
30
+	esac
31
+
25 32
 	mkdir -p "$version"
26 33
 	echo "$version -> FROM $from"
27 34
 	cat > "$version/Dockerfile" <<-EOF
... ...
@@ -32,13 +39,6 @@ for version in "${versions[@]}"; do
32 32
 		FROM $from
33 33
 	EOF
34 34
 
35
-	case "$from" in
36
-		debian:wheezy)
37
-			# add -backports, like our users have to
38
-			echo "RUN echo deb http://http.debian.net/debian $suite-backports main > /etc/apt/sources.list.d/$suite-backports.list" >> "$version/Dockerfile"
39
-			;;
40
-	esac
41
-
42 35
 	echo >> "$version/Dockerfile"
43 36
 
44 37
 	extraBuildTags=
45 38
new file mode 100755
... ...
@@ -0,0 +1,29 @@
0
+#!/bin/bash
1
+# This script is used for testing install.sh and that it works for
2
+# each of component of our apt and yum repos
3
+set -e
4
+
5
+test_install_script(){
6
+	# these are equivalent to main, testing, experimental components
7
+	# in the repos, but its the url that will do the conversion
8
+	components=( experimental test get )
9
+
10
+	for component in "${components[@]}"; do
11
+		# change url to specific component for testing
12
+		local test_url=https://${component}.docker.com
13
+		local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
14
+		sed "s,url='https://get.docker.com/',url='${test_url}/'," hack/install.sh > "${script}"
15
+
16
+		chmod +x "${script}"
17
+
18
+		# test for each Dockerfile in contrib/builder
19
+		for dir in contrib/builder/*/*/; do
20
+			local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
21
+
22
+			echo "running install.sh for ${component} with ${from}"
23
+			docker run --rm -it -v ${script}:/install.sh ${from} /install.sh
24
+		done
25
+	done
26
+}
27
+
28
+test_install_script