Skip to content

Commit 400ac8a

Browse files
committed
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>
1 parent 4a6e8c8 commit 400ac8a

File tree

1 file changed

+62
-2
lines changed

1 file changed

+62
-2
lines changed

hack/install.sh

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ check_forked() {
8080
fi
8181
}
8282

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+
8393
do_install() {
8494
case "$(uname -m)" in
8595
*64)
@@ -231,10 +241,60 @@ do_install() {
231241
exit 0
232242
;;
233243

234-
'opensuse project'|opensuse|'suse linux'|sle[sd])
244+
'opensuse project'|opensuse)
245+
echo 'Going to perform the following operations:'
246+
if [ "$repo" != 'main' ]; then
247+
echo ' * add repository obs://Virtualization:containers'
248+
fi
249+
echo ' * install Docker'
250+
$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
251+
252+
if [ "$repo" != 'main' ]; then
253+
# install experimental packages from OBS://Virtualization:containers
254+
(
255+
set -x
256+
zypper -n ar -f obs://Virtualization:containers Virtualization:containers
257+
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
258+
)
259+
fi
260+
(
261+
set -x
262+
zypper -n install docker
263+
)
264+
echo_docker_as_nonroot
265+
exit 0
266+
;;
267+
'suse linux'|sle[sd])
268+
echo 'Going to perform the following operations:'
269+
if [ "$repo" != 'main' ]; then
270+
echo ' * add repository obs://Virtualization:containers'
271+
echo ' * install experimental Docker using packages NOT supported by SUSE'
272+
else
273+
echo ' * add the "Containers" module'
274+
echo ' * install Docker using packages supported by SUSE'
275+
fi
276+
$sh_c 'echo "Press CTRL-C to abort"; sleep 3'
277+
278+
if [ "$repo" != 'main' ]; then
279+
# install experimental packages from OBS://Virtualization:containers
280+
echo >&2 'Warning: installing experimental packages from OBS, these packages are NOT supported by SUSE'
281+
(
282+
set -x
283+
zypper -n ar -f obs://Virtualization:containers/SLE_12 Virtualization:containers
284+
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
285+
)
286+
else
287+
# Add the containers module
288+
# Note well-1: the SLE machine must already be registered against SUSE Customer Center
289+
# Note well-2: the `-r ""` is required to workaround a known issue of SUSEConnect
290+
(
291+
set -x
292+
SUSEConnect -p sle-module-containers/12/x86_64 -r ""
293+
)
294+
fi
235295
(
236296
set -x
237-
$sh_c 'sleep 3; zypper -n install docker'
297+
zypper -n install docker
238298
)
239299
echo_docker_as_nonroot
240300
exit 0

0 commit comments

Comments
 (0)