Skip to content

Commit

Permalink
Merge pull request #252 from VictorLowther/feature/centos-62/openstac…
Browse files Browse the repository at this point in the history
…k-os-build

Add CentOS 6.2 support and rework our Chef hotpatching infrastructure. [6/7]
  • Loading branch information
VictorLowther committed Mar 17, 2012
2 parents 6d39e91 + 56f856f commit 4bae1ca
Show file tree
Hide file tree
Showing 29 changed files with 888 additions and 1,380 deletions.
2 changes: 1 addition & 1 deletion barclamps/crowbar
Submodule crowbar updated 1 files
+1 −2 crowbar.yml
2 changes: 1 addition & 1 deletion barclamps/network
Submodule network updated 1 files
+2 −1 crowbar.yml
5 changes: 3 additions & 2 deletions build_lib.sh
Expand Up @@ -448,8 +448,9 @@ make_barclamp_pkg_metadata() {
[[ $ALLOW_CACHE_UPDATE != true && \
$ALLOW_CACHE_METADATA_UPDATE != true ]] && return 0
[[ -d $CACHE_DIR/barclamps/$1/$OS_TOKEN/pkgs ]] || return 0
[[ $force_update=true ]] || __barclamp_pkg_metadata_needs_update "$1" || \
return 0
if [[ $force_update != true ]]; then
__barclamp_pkg_metadata_needs_update "$1" || return 0
fi
[[ $ALLOW_CACHE_METADATA_UPDATE = false ]] && \
die "Need to update cache metadata for $1, but --no-metadata-update passed."
debug "Updating package cache metadata for $1"
Expand Down
82 changes: 82 additions & 0 deletions centos-6.2-extra/build_lib.sh
@@ -0,0 +1,82 @@
#!/bin/bash
# This is sourced by build_crowbar.sh to enable it to stage Crowbar onto
# CentOS 6.2


# OS information for the OS we are building crowbar on to.
OS=centos
OS_VERSION=6.2

# If we need to make a chroot to stage packages into, this is the minimal
# set of packages needed to bootstrap yum. This package list has only been tested
# on CentOS 6.2.

OS_BASIC_PACKAGES=(MAKEDEV upstart audit-libs basesystem bash binutils \
bzip2-libs chkconfig cracklib cracklib-dicts crontabs coreutils db4 \
device-mapper e2fsprogs e2fsprogs-libs elfutils-libelf ethtool expat \
file-libs filesystem findutils gawk gdbm glib2 glibc glibc-common grep \
info initscripts iputils keyutils-libs krb5-libs libacl libattr libcap \
libcom_err libgcc libidn libselinux libsepol libstdc++ libsysfs libgcrypt \
libnih dbus-libs libcurl curl lua compat-libtermcap libutempter libxml2 \
libxml2-python logrotate m2crypto mcstrans mingetty mlocate \
module-init-tools ncurses ncurses-libs neon net-tools nss nss-sysinit \
nss-softokn nss-softokn-freebl openldap libssh2 cyrus-sasl-lib nss-util \
nspr openssl pam passwd libuser pcre popt procps psmisc python \
python-libs python-pycurl python-iniparse python-urlgrabber readline rpm \
rpm-libs rpm-python sed setup shadow-utils centos-release \
sqlite rsyslog tzdata udev util-linux-ng xz xz-libs yum \
yum-plugin-downloadonly yum-metadata-parser yum-utils zlib)

#
# See:
# http://www.steve.org.uk/Software/rinse/
# http://repository.steve.org.uk/cgi-bin/hgwebdir.cgi/rinse/file/964ec9650f08/etc

OS_REPO_POOL=""

# The name of the OS iso we are using as a base.
[[ $ISO ]] || ISO="CentOS-6.2-x86_64-bin-DVD1.iso"

# We always want to shrink the generated ISO, otherwise the install will
# fail due to lookingfor packages on the second ISO that we don't have.
SHRINK_ISO=true

# The location of OS packages on $ISO
find_cd_pool() ( echo "$IMAGE_DIR/Packages" )

# There is no public location to fetch the RHEL .iso from. If you have one,
# you can change this function.
fetch_os_iso() {
die "build_crowbar.sh does not know how to automatically download $ISO"
}

# Throw away packages we will not need on the iso
shrink_iso() {
# Do nothing if we do not have a minimal-install set for this OS.
[[ -f $CROWBAR_DIR/$OS_TOKEN-extra/minimal-install ]] || \
return 0
local pkgname pkgver
while read pkgname pkgver; do
INSTALLED_PKGS["$pkgname"]="$pkgver"
done < "$CROWBAR_DIR/$OS_TOKEN-extra/minimal-install"
mkdir -p "$BUILD_DIR/Packages"
cp -a "$IMAGE_DIR/repodata" "$BUILD_DIR"
make_chroot
# Figure out what else we need for this build
# that we did not get from the appropriate minimal-install.
check_all_deps $(for bc in "${BARCLAMPS[@]}"; do
echo ${BC_PKGS[$bc]}; done)
for pkgname in "${!CD_POOL[@]}"; do
[[ ${INSTALLED_PKGS["$pkgname"]} ]] || continue
[[ -f ${CD_POOL["$pkgname"]} ]] || \
die "Cannot stage $pkgname from the CD!"
cp "${CD_POOL["$pkgname"]}" "$BUILD_DIR/Packages"
done
sudo mount --bind "$BUILD_DIR" "$CHROOT/mnt"
in_chroot /bin/bash -c 'cd /mnt; createrepo -g /mnt/repodata/3a27232698a261aa4022fd270797a3006aa8b8a346cbd6a31fae1466c724d098-c6-x86_64-comps.xml .'
sudo umount -l "$CHROOT/mnt"
sudo mount -t tmpfs -o size=1K tmpfs "$IMAGE_DIR/Packages"
sudo mount -t tmpfs -o size=1K tmpfs "$IMAGE_DIR/repodata"
}

. "$CROWBAR_DIR/redhat-common/build_lib.sh"
57 changes: 57 additions & 0 deletions centos-6.2-extra/cdrom.ks
@@ -0,0 +1,57 @@
# Kickstart file automatically generated by anaconda.

install
cdrom
key --skip
lang en_US.UTF-8
keyboard us
text
# crowbar
rootpw --iscrypted $1$H6F/NLec$Fps2Ut0zY4MjJtsa1O2yk0
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Europe/London
bootloader --location=mbr --driveorder=sda
zerombr
ignoredisk --only-use=sda
clearpart --all --drives=sda
part /boot --fstype ext4 --size=100 --ondisk=sda
part swap --recommended
part pv.6 --size=1 --grow --ondisk=sda
volgroup lv_admin --pesize=32768 pv.6
logvol / --fstype ext4 --name=lv_root --vgname=lv_admin --size=1 --grow
reboot

%packages
@base
@core
vim-enhanced
keyutils
trousers
fipscheck
device-mapper-multipath
OpenIPMI
OpenIPMI-tools
emacs-nox
openssh
createrepo

%post --nochroot
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
set -x
(
ls -al /tmp
mount
mkdir -p /mnt/sysimage/tftpboot/redhat_dvd/dell
cp -a /mnt/source/. /mnt/sysimage/tftpboot/redhat_dvd/.
) &>/mnt/sysimage/root/post-install-copy.log

%post
export OS_TOKEN="centos-6.2"
export BASEDIR="/tftpboot/redhat_dvd"
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
set -x
exec &>/root/post-install.log

. /tftpboot/redhat_dvd/extra/redhat-common-post.sh
24 changes: 24 additions & 0 deletions centos-6.2-extra/install
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Script: install
#
# Copyright (c) 2011 Dell Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

export OS_TOKEN=centos-6.2

cd /tftpboot/redhat_dvd/extra
script -f -c "./install-chef.sh $1" /var/log/install.log
cd -

0 comments on commit 4bae1ca

Please sign in to comment.