Browse code

Update SUSE/openSUSE installation script

Fix installation on SUSE Linux Enterprise machine, the updated Docker RPMs have
been moved to a different location.

Update both openSUSE and SUSE Linux Enterprise scripts to allow the
installation of experimental builds.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

Flavio Castelli authored on 2015/09/10 22:48:25
Showing 1 changed files
... ...
@@ -80,6 +80,16 @@ check_forked() {
80 80
 	fi
81 81
 }
82 82
 
83
+rpm_import_repository_key() {
84
+	local key=$1; shift
85
+	local tmpdir=$(mktemp -d)
86
+	chmod 600 "$tmpdir"
87
+	gpg --homedir "$tmpdir" --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"
88
+	gpg --homedir "$tmpdir" --export --armor "$key" > "$tmpdir"/repo.key
89
+	rpm --import "$tmpdir"/repo.key
90
+	rm -rf "$tmpdir"
91
+}
92
+
83 93
 do_install() {
84 94
 	case "$(uname -m)" in
85 95
 		*64)
... ...
@@ -231,10 +241,60 @@ do_install() {
231 231
 			exit 0
232 232
 			;;
233 233
 
234
-		'opensuse project'|opensuse|'suse linux'|sle[sd])
234
+		'opensuse project'|opensuse)
235
+			echo 'Going to perform the following operations:'
236
+			if [ "$repo" != 'main' ]; then
237
+				echo '  * add repository obs://Virtualization:containers'
238
+			fi
239
+			echo '  * install Docker'
240
+			$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
241
+
242
+			if [ "$repo" != 'main' ]; then
243
+				# install experimental packages from OBS://Virtualization:containers
244
+				(
245
+					set -x
246
+					zypper -n ar -f obs://Virtualization:containers Virtualization:containers
247
+					rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
248
+				)
249
+			fi
250
+			(
251
+				set -x
252
+				zypper -n install docker
253
+			)
254
+			echo_docker_as_nonroot
255
+			exit 0
256
+			;;
257
+		'suse linux'|sle[sd])
258
+			echo 'Going to perform the following operations:'
259
+			if [ "$repo" != 'main' ]; then
260
+				echo '  * add repository obs://Virtualization:containers'
261
+				echo '  * install experimental Docker using packages NOT supported by SUSE'
262
+			else
263
+				echo '  * add the "Containers" module'
264
+				echo '  * install Docker using packages supported by SUSE'
265
+			fi
266
+			$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
267
+
268
+			if [ "$repo" != 'main' ]; then
269
+				# install experimental packages from OBS://Virtualization:containers
270
+				echo >&2 'Warning: installing experimental packages from OBS, these packages are NOT supported by SUSE'
271
+				(
272
+					set -x
273
+					zypper -n ar -f obs://Virtualization:containers/SLE_12 Virtualization:containers
274
+					rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
275
+				)
276
+			else
277
+				# Add the containers module
278
+				# Note well-1: the SLE machine must already be registered against SUSE Customer Center
279
+				# Note well-2: the `-r ""` is required to workaround a known issue of SUSEConnect
280
+				(
281
+					set -x
282
+					SUSEConnect -p sle-module-containers/12/x86_64 -r ""
283
+				)
284
+			fi
235 285
 			(
236 286
 				set -x
237
-				$sh_c 'sleep 3; zypper -n install docker'
287
+				zypper -n install docker
238 288
 			)
239 289
 			echo_docker_as_nonroot
240 290
 			exit 0