From 02e73386cc37732842b0f49f94835e2328ca35fc Mon Sep 17 00:00:00 2001 From: Sam Betts Date: Thu, 14 Apr 2016 17:43:54 +0100 Subject: [PATCH] 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 --- imagebuild/coreos/build_coreos_image.sh | 4 ++++ imagebuild/coreos/full_trusty_build.sh | 12 ++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/imagebuild/coreos/build_coreos_image.sh b/imagebuild/coreos/build_coreos_image.sh index 1260923dd..e7d45044a 100755 --- a/imagebuild/coreos/build_coreos_image.sh +++ b/imagebuild/coreos/build_coreos_image.sh @@ -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 diff --git a/imagebuild/coreos/full_trusty_build.sh b/imagebuild/coreos/full_trusty_build.sh index 1b6fcd39f..c7c0c9d5e 100755 --- a/imagebuild/coreos/full_trusty_build.sh +++ b/imagebuild/coreos/full_trusty_build.sh @@ -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