changeset 1252:8e3adc6264d3

Don't depend on USER being set in build_nightly as it does not seem to work when build job is run from cron
author Michael Pavone <pavone@retrodev.com>
date Mon, 27 Feb 2017 00:38:53 -0800
parents f249fd91b0f5
children 2a6049dddab0
files build_nightly build_upload_nightly
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/build_nightly	Mon Feb 27 00:28:05 2017 -0800
+++ b/build_nightly	Mon Feb 27 00:38:53 2017 -0800
@@ -3,8 +3,9 @@
 set -e
 
 build_user=$1
-if [ $USER != $build_user ]; then
-	su $build_user -c "$0 $@";
+needsu=$2
+if [ "$needsu" = needsu ]; then
+	su $build_user -c "$0 $1";
 	exit
 fi
 
--- a/build_upload_nightly	Mon Feb 27 00:28:05 2017 -0800
+++ b/build_upload_nightly	Mon Feb 27 00:38:53 2017 -0800
@@ -9,12 +9,12 @@
 fi
 sleep 10
 echo Starting build by $BUILD_USER in $CONTAINER_NAME
-lxc-attach -n "$CONTAINER_NAME" -- /home/$BUILD_USER/blastem/build_nightly $BUILD_USER 2>&1 > /tmp/build_${name}_out.log
+lxc-attach -n "$CONTAINER_NAME" -- /home/$BUILD_USER/blastem/build_nightly $BUILD_USER needsu 2>&1 > /tmp/build_${name}_out.log
 result=$?
 if [ $result -ne 0 ]; then
 	echo Build falied with return code $result stopping $CONTAINER_NAME
 	lxc-stop -n "$CONTAINER_NAME"
-	exit $?
+	exit $result
 fi
 echo "Build succeeded, stopping $CONTAINER_NAME"
 lxc-stop -n "$CONTAINER_NAME"