summaryrefslogtreecommitdiffstats
path: root/redhat/docker/opensuse32.sh
blob: a3b888c75871704b8f8a45f3c904c84550547d3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

NAME="opensuse32"
VERSION="$1" # E.g: '42.3'
IMAGE="${NAME}:${VERSION}"
INSTALLROOT="/dev/shm/${IMAGE}"

sudo rm -rf "${INSTALLROOT}"
sudo mkdir -p "${INSTALLROOT}"

if [ "${VERSION}" = "tumbleweed" ]; then
  URL="http://download.opensuse.org/tumbleweed"
else
  URL="http://download.opensuse.org/distribution/leap/${VERSION}"
fi

sudo zypper --root "${INSTALLROOT}" \
  ar "${URL}/repo/oss/" "oss"
sudo zypper --root "${INSTALLROOT}" \
  ar "${URL}/repo/non-oss/" "non-oss"

if [ "${VERSION}" != "tumbleweed" ]; then
  sudo zypper --root "${INSTALLROOT}" \
    ar "http://download.opensuse.org/update/leap/${VERSION}/oss/" "update-oss"
  sudo zypper --root "${INSTALLROOT}" \
    ar "http://download.opensuse.org/update/leap/${VERSION}/non-oss/" "update-non-oss"
fi
setarch i686 sudo zypper --root "${INSTALLROOT}" \
  --gpg-auto-import-keys ref
setarch i686 sudo zypper --root "${INSTALLROOT}" \
  install -y bash vim zypper openSUSE-release

sudo tar -C "${INSTALLROOT}" -c . >"${IMAGE}.tar"
sudo rm -rf "${INSTALLROOT}"

docker rmi -f "${IMAGE}"
docker import "${IMAGE}.tar" "${IMAGE}"