Last active
October 24, 2018 15:13
-
-
Save trevor-vaughan/f42d20b3fe4cc3d1b893d16b1be4f20d to your computer and use it in GitHub Desktop.
Script for building SIMP 6.1+ for RHEL in AWS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash --login | |
# Script for building SIMP on AWS RHEL systems | |
# IMPORTANT! | |
# | |
# Be sure to rename the tarball to 'SIMP-<VERSION>.el7-RedHat-7-x86_64.tar.gz' | |
# | |
# | |
# Build tarballs can be downloaded from https://simp-project.com/ISO/SIMP/tar_bundles | |
# | |
set -e | |
SIMP_VERSION='6.2.0-0' | |
iso_dir="${HOME}/ISO" | |
top_dir=`pwd` | |
build_docs='yes' | |
rhel_release=`facter operatingsystemmajrelease` | |
function build_rhel() { | |
cd $top_dir | |
mkdir EL${rhel_release} ||: | |
cd EL${rhel_release} | |
git clone https://github.com/simp/simp-core ||: | |
cd simp-core | |
git checkout $SIMP_VERSION | |
bundle update | |
# Artifact of silliness | |
if [ "${rhel_release}" == '7' ]; then | |
ruby -ryaml -e 'x=YAML.load_file("build/distributions/build_metadata.yaml"); x["distributions"]["RedHat"]["7"]["build"]=true; x["distributions"]["CentOS"]["7"]["build"]=false; f=File.open("build/distributions/build_metadata.yaml","w"); f.puts(x.to_yaml)' | |
fi | |
mkdir -p build/distributions/RedHat/${rhel_release}/x86_64/DVD_Overlay | |
cp ~/SIMP-${SIMP_VERSION}.el${rhel_release}-RedHat-${rhel_release}-x86_64.tar.gz build/distributions/RedHat/${rhel_release}/x86_64/DVD_Overlay | |
cp /etc/yum.repos.d/* build/distributions/RedHat/${rhel_release}/x86_64/yum_data/repos | |
cat <<HERE > build/distributions/RedHat/${rhel_release}/x86_64/yum_data/repos/archive.repo | |
[snapshot-${SIMP_VERSION}] | |
name=snapshot-${SIMP_VERSION} | |
baseurl=https://download.simp-project.com/SIMP/archive/yum/Releases/${SIMP_VERSION}/EL${rhel_release}/core | |
gpgcheck=1 | |
enabled=1 | |
gpgkey=https://raw.githubusercontent.com/NationalSecurityAgency/SIMP/master/GPGKEYS/RPM-GPG-KEY-SIMP | |
[snapshot-${SIMP_VERSION}-deps] | |
name=snapshot-${SIMP_VERSION}-deps | |
baseurl=https://download.simp-project.com/SIMP/archive/yum/Releases/${SIMP_VERSION}/EL${rhel_release}/dependencies | |
gpgcheck=1 | |
enabled=1 | |
gpgkey=https://raw.githubusercontent.com/NationalSecurityAgency/SIMP/master/GPGKEYS/RPM-GPG-KEY-SIMP | |
https://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs | |
https://yum.puppetlabs.com/RPM-GPG-KEY-puppet | |
https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-94 | |
https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-96 | |
https://getfedora.org/static/0608B895.txt | |
HERE | |
SIMP_BUILD_rm_staging_dir=no SIMP_BUILD_docs=$build_docs SIMP_BUILD_prompt=yes rake build:auto[$iso_dir] | |
} | |
if [ -z "${SIMP_VERSION}" ]; then | |
echo 'You MUST set SIMP_VERSION at the top of this file before proceeding!' | |
exit 1 | |
fi | |
echo "## Building EL${rhel_release}" | |
build_rhel | |
cp -l EL${rhel_release}/simp-core/build/distributions/RedHat/${rhel_release}/x86_64/SIMP_ISO/*.iso . | |
echo '## Build complete' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment