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
This commit is contained in:
Sam Betts 2016-04-14 17:43:54 +01:00
parent 8ce07c88be
commit 02e73386cc
2 changed files with 10 additions and 6 deletions

View File

@ -22,3 +22,7 @@ sudo -E pip install -r requirements.txt
cd imagebuild/coreos
sudo -E make clean
sudo -E make
# Output of make is owned by root, so convert owner to user who started the script
me=`whoami`
sudo chown -R $me: UPLOAD

View File

@ -27,17 +27,17 @@ imagebuild/coreos/build_coreos_image.sh
BUILD_DIR=imagebuild/coreos/UPLOAD
if [ "$BRANCH_PATH" != "master" ]; then
# add the branch name
sudo mv $BUILD_DIR/coreos_production_pxe_image-oem.cpio.gz $BUILD_DIR/coreos_production_pxe_image-oem-$BRANCH_PATH.cpio.gz
sudo mv $BUILD_DIR/coreos_production_pxe.vmlinuz $BUILD_DIR/coreos_production_pxe-$BRANCH_PATH.vmlinuz
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
sudo cp $BUILD_DIR/coreos_production_pxe_image-oem.cpio.gz $BUILD_DIR/coreos_production_pxe_image-oem-$BRANCH_PATH.cpio.gz
sudo cp $BUILD_DIR/coreos_production_pxe.vmlinuz $BUILD_DIR/coreos_production_pxe-$BRANCH_PATH.vmlinuz
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
sudo 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
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
sudo cp ipa-coreos-$BRANCH_PATH.tar.gz ipa-coreos.tar.gz
cp ipa-coreos-$BRANCH_PATH.tar.gz ipa-coreos.tar.gz
fi