summaryrefslogtreecommitdiffstats
path: root/redhat/docker/fedora32.sh
blob: 823b27fbca64a85c5de765ab7bdc4227d4f4bc9f (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
#!/bin/bash

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

sudo rm -rf "${INSTALLROOT}"
setarch i686 sudo dnf install \
  --refresh \
  --installroot="${INSTALLROOT}" \
  --releasever="${VERSION}" \
  --disablerepo="*" --enablerepo="fedora,updates" \
  --nodocs \
  --assumeyes \
  @core bash vim

sudo sed -i "${INSTALLROOT}/etc/yum.repos.d/"*".repo" \
         -e "s|\$basearch|i386|g" \
         -e "s|\$releasever|${VERSION}|g"

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

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