ironic-python-agent/imagebuild/coreos/full_trusty_build.sh
Sam Betts 02e73386cc Make "make coreos" output moveable without sudo
The build_coreos_image.sh script outputs files owned by root because it
runs the make coreos, using sudo. This patch adds a couple of lines in
that script to ensure that the files created are useable without having to
use sudo after the script is finished.

** The coreos build post job requires this change **

Change-Id: Id462ac350940bd70b40e5ca76521ecf3e652f0e0
2016-04-14 17:59:08 +01:00

44 lines
1.8 KiB
Bash
Executable File

#!/bin/bash -xe
#
# From a base-trusty node, this should build a CoreOS IPA image
# suitable for use in testing or production.
#
BRANCH_PATH=${BRANCH_PATH:-master}
# NOTE(lucasagomes): List of dependencies for Red Hat systems
REDHAT_PACKAGES="docker-io gpg"
if [ -x "/usr/bin/apt-get" ]; then
sudo -E apt-get update
# apparmor is an undeclared dependency for docker on ubuntu
# https://github.com/docker/docker/issues/9745
sudo -E apt-get install -y docker.io apparmor cgroup-lite
elif [ -x "/usr/bin/dnf" ]; then
sudo -E dnf install -y $REDHAT_PACKAGES
elif [ -x "/usr/bin/yum" ]; then
sudo -E yum install -y $REDHAT_PACKAGES
else
echo "No supported package manager installed on system. Supported: apt, yum, dnf"
exit 1
fi
imagebuild/coreos/build_coreos_image.sh
BUILD_DIR=imagebuild/coreos/UPLOAD
if [ "$BRANCH_PATH" != "master" ]; then
# add the branch name
mv $BUILD_DIR/coreos_production_pxe_image-oem.cpio.gz $BUILD_DIR/coreos_production_pxe_image-oem-$BRANCH_PATH.cpio.gz
mv $BUILD_DIR/coreos_production_pxe.vmlinuz $BUILD_DIR/coreos_production_pxe-$BRANCH_PATH.vmlinuz
else
# in the past, we published master without branch name
# copy the files in this case such that both are published
cp $BUILD_DIR/coreos_production_pxe_image-oem.cpio.gz $BUILD_DIR/coreos_production_pxe_image-oem-$BRANCH_PATH.cpio.gz
cp $BUILD_DIR/coreos_production_pxe.vmlinuz $BUILD_DIR/coreos_production_pxe-$BRANCH_PATH.vmlinuz
fi
tar czf ipa-coreos-$BRANCH_PATH.tar.gz $BUILD_DIR/coreos_production_pxe_image-oem-$BRANCH_PATH.cpio.gz $BUILD_DIR/coreos_production_pxe-$BRANCH_PATH.vmlinuz
if [ "$BRANCH_PATH" = "master" ]; then
# again, publish with and without the branch on master for historical reasons
cp ipa-coreos-$BRANCH_PATH.tar.gz ipa-coreos.tar.gz
fi