diff options
author | François Andriot <[email protected]> | 2018-11-27 21:34:48 +0100 |
---|---|---|
committer | François Andriot <[email protected]> | 2018-11-27 21:34:48 +0100 |
commit | a615d19df88eb2e989316b480519161945dbc7dc (patch) | |
tree | 369970b98042998b86c11024598155e037b76fec /redhat/docker/centos32.sh | |
parent | 76a93e0011ade1583a1ec672f33411dfd35454f3 (diff) | |
download | tde-packaging-a615d19df88eb2e989316b480519161945dbc7dc.tar.gz tde-packaging-a615d19df88eb2e989316b480519161945dbc7dc.zip |
RPM: merge redhat directory with master branch
Diffstat (limited to 'redhat/docker/centos32.sh')
-rwxr-xr-x | redhat/docker/centos32.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/redhat/docker/centos32.sh b/redhat/docker/centos32.sh new file mode 100755 index 000000000..afbb25a7f --- /dev/null +++ b/redhat/docker/centos32.sh @@ -0,0 +1,50 @@ +#!/bin/bash -ex + +[ "$(whoami)" = "root" ] || exec sudo $0 $@ +[ "$(rpm -E %_arch)" = "x86_64" ] && exec setarch i686 $0 $@ + +cd "$(dirname "$0")" + +NAME="centos32" +VERSION="$1" # E.g: '5' +IMAGE="${NAME}:${VERSION}" +INSTALLROOT="/dev/shm/${IMAGE}" +DIR="el${VERSION}" + +REPO="centos-${VERSION}" + +# Installation minimale de la distribution +rm -rf "${INSTALLROOT}" +install -m 644 "${DIR}/${REPO}.repo" "/etc/yum.repos.d" +yum install --disablerepo="*" --enablerepo="${REPO}*" --nogpgcheck --releasever="${VERSION}" -y --installroot "${INSTALLROOT}" libselinux yum yum-plugin-ovl +rm -f "/etc/yum.repos.d/${REPO}.repo" +touch "${INSTALLROOT}/etc/fstab" "${INSTALLROOT}/etc/mtab" + +# Activation des dépôts YUM de l'atelier DEPL-IT (remplace les dépôts Internet) +rm -f "${INSTALLROOT}/etc/yum.repos.d/"*".repo" +install -m 644 "${DIR}/${REPO}.repo" "${INSTALLROOT}/etc/yum.repos.d" +install -m 644 "/etc/resolv.conf" "${INSTALLROOT}/etc/resolv.conf" +rm -f "${INSTALLROOT}/etc/group" "${INSTALLROOT}/etc/passwd" "${INSTALLROOT}/etc/pam.d/system-auth" "${INSTALLROOT}/usr/share/info/dir" + +# Ré-installation de la distribution en utilisant le "yum" intégré +rm -rf "${INSTALLROOT}/var/lib/rpm/"* +install -m 644 "${DIR}/"{epel,repoforge}*".repo" "${INSTALLROOT}/etc/yum.repos.d" +cp -a "/dev/urandom" "${INSTALLROOT}/dev/urandom" +chroot "${INSTALLROOT}" yum install --nogpgcheck -y $(<${DIR}/packages.base) +find "${INSTALLROOT}" -name "*.rpmnew" -delete + +# Création de l'image Tar +tar -C "${INSTALLROOT}" -c . >"${IMAGE}.tar" +rm -rf "${INSTALLROOT}" + +# Création de l'image Docker +if [ "$(docker images -q "${IMAGE}")" != "" ]; then + docker rmi -f "${IMAGE}" +fi +docker import "${IMAGE}.tar" "${IMAGE}" + +# Test de l'image +docker run "${IMAGE}" yum repolist + + +exit 0 |