Merge "CentOS 6 Element"

This commit is contained in:
Jenkins 2015-03-19 19:42:40 +00:00 committed by Gerrit Code Review
commit e0e0159ef7
12 changed files with 105 additions and 6 deletions

View File

@ -0,0 +1,6 @@
======
centos
======
Use Centos 6 cloud images as the baseline for built disk images.
For further details see the redhat-common README.

View File

@ -0,0 +1,5 @@
cache-url
dib-run-parts
redhat-common
rpm-distro
yum

View File

@ -0,0 +1 @@
operating-system

View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
export DIB_EXTLINUX=1

View File

@ -0,0 +1 @@
export DISTRO_NAME=centos

View File

@ -0,0 +1,4 @@
parted:
cloud-utils:
cloud-utils-growpart:
dracut-modules-growpart:

View File

@ -0,0 +1,25 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
cat << EOF > /etc/yum.repos.d/centos6-latest.repo
[rhel6]
name=centos6
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
enabled=1
metadata_expire=7d
gpgcheck=0
EOF
cat << EOF > /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - \$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch
failovermethod=priority
enabled=1
gpgcheck=0
EOF

View File

@ -0,0 +1,34 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]
if [ 'amd64' = "$ARCH" ] ; then
ARCH="x86_64"
fi
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-}
if [ -n "$DIB_LOCAL_IMAGE" ]; then
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
# No need to copy a local image into the cache directory, so just specify
# the cached path as the original path.
CACHED_IMAGE=$IMAGE_LOCATION
BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE)
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
else
DIB_RELEASE=${DIB_RELEASE:-GenericCloud-20141129_01}
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/6/images}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-6-x86_64-$DIB_RELEASE.qcow2}
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
fi
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE

View File

@ -27,7 +27,7 @@ def eprint(msg):
def os_family(distro):
family = None
if distro in ['fedora', 'rhel', 'rhel7', 'centos7']:
if distro in ['fedora', 'rhel', 'rhel7', 'centos', 'centos7']:
family = 'redhat'
elif distro in ['debian', 'ubuntu']:
family = 'debian'

View File

@ -78,8 +78,14 @@ function extract_image() {
EACTION="sudo umount -f $WORKING/mnt ; $EACTION"
trap "$EACTION" EXIT
# find out if chroot tar has full xattr support
if [ 0 == `sudo chroot $WORKING/mnt bin/tar --help | grep -c xattrs-exclude` ]; then
TAROPTS="--no-xattrs"
else
TAROPTS="--xattrs --xattrs-include='*' --xattrs-exclude='security.selinux'"
fi
# Chroot in so that we get the correct uid/gid
sudo chroot $WORKING/mnt bin/tar --xattrs --xattrs-include='*' --xattrs-exclude='security.selinux' -cz . > $WORKING/tmp.tar
sudo chroot $WORKING/mnt bin/tar $TAROPTS -cz . > $WORKING/tmp.tar
mv $WORKING/tmp.tar $CACHED_TAR
else
echo "Using cached tar from $CACHED_TAR"

View File

@ -1,13 +1,21 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
GRUBNAME=$(which grub-install) || echo "trying grub2-install"
if [ -z "$GRUBNAME" ]; then
GRUBNAME=$(which grub2-install)
fi
if [ -z "$GRUBNAME" ] || [ $($GRUBNAME --version | grep -c "0.97") -ne 0 ]; then
echo "No GRUB2 found. No need to remove"
exit 0
else
# Must manually remove grub2 here, otherwise the download below does not work.
yum remove -y grub2
yum remove -y grub2
fi
# Remove all old versions of grub2 from the yum cache and then ensure the
# latest version is in the cache.

View File

@ -21,7 +21,7 @@ import yaml
def os_family(distro):
"Given a distribution, returns a operating system family."
family = None
if distro in ['centos7', 'fedora', 'rhel', 'rhel7']:
if distro in ['centos', 'centos7', 'fedora', 'rhel', 'rhel7']:
family = 'redhat'
elif distro in ['debian', 'ubuntu']:
family = 'debian'