From d07336d6b88f96527d2d3881e0ccdd0991bd111d Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 15 Oct 2016 21:43:27 +0200 Subject: added Centos 7 --- examples/build_gold_image/build_centos7.sh | 89 ++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 examples/build_gold_image/build_centos7.sh diff --git a/examples/build_gold_image/build_centos7.sh b/examples/build_gold_image/build_centos7.sh new file mode 100755 index 0000000..f70a9e5 --- /dev/null +++ b/examples/build_gold_image/build_centos7.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +# Centos 7 + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:${PATH} + +ARCH=$1 + +if test "x$ARCH" = "x"; then + echo "One argument expected (architecture)" 1>&2 + exit 1 +fi + +case $ARCH in + i686) + PACKAGE_ARCH=i386 + ARCH_SWITCH=linux32 + ;; + + x86_64) + PACKAGE_ARCH=x86_64 + ARCH_SWITCH= + ;; + + *) + echo "Unsupported architecture '$ARCH'" 1>&2 + exit 1 +esac + +CHROOT_DIR=rhel7-${ARCH} + +rm -rf $CHROOT_DIR + +mkdir $CHROOT_DIR + +mkdir -p $CHROOT_DIR/var/lib/rpm + +rpm -v --rebuilddb --root=`pwd`/$CHROOT_DIR + +wget http://mirror.centos.org/centos/7.2.1511/os/${PACKAGE_ARCH}/Packages/centos-release-7-2.1511.el7.centos.2.10.${ARCH}.rpm + +rpm -v -i --root=`pwd`/$CHROOT_DIR --nodeps centos-release-7-2.1511.el7.centos.2.10.${ARCH}.rpm + +rm -f centos-release-7-2.1511.el7.centos.2.10.${ARCH}.rpm + +wget http://mirror.centos.org/centos/7.2.1511/os/${PACKAGE_ARCH}/RPM-GPG-KEY-CentOS-7 + +rpm -v --root=`pwd`/$CHROOT_DIR --import RPM-GPG-KEY-CentOS-7 + +rm RPM-GPG-KEY-CentOS-7 + +${ARCH_SWITCH} yum --installroot=`pwd`/$CHROOT_DIR install -y yum +${ARCH_SWITCH} yum --installroot=`pwd`/$CHROOT_DIR install -y coreutils procps net-tools wget + +# rebuild the RPM database with the rpm inside the chroot +${ARCH_SWITCH} chroot $CHROOT_DIR /bin/rpm -v --rebuilddb + +mknod -m 666 $CHROOT_DIR/dev/null c 1 3 +mknod -m 666 $CHROOT_DIR/dev/zero c 1 5 +mknod -m 666 $CHROOT_DIR/dev/random c 1 8 +mknod -m 666 $CHROOT_DIR/dev/urandom c 1 9 +mknod -m 666 $CHROOT_DIR/dev/tty c 5 0 + +cp /etc/resolv.conf $CHROOT_DIR/etc/ + +cp $CHROOT_DIR/etc/skel/.bashrc $CHROOT_DIR/root +cp $CHROOT_DIR/etc/skel/.bash_profile $CHROOT_DIR/root +cp $CHROOT_DIR/etc/skel/.bash_logout $CHROOT_DIR/root + +cat >> $CHROOT_DIR/root/.bash_profile <