summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-02-27 00:38:53 -0800
committerMichael Pavone <pavone@retrodev.com>2017-02-27 00:38:53 -0800
commit9365670c39ba8aa2f949e7f4dfae7dc0e1be16d8 (patch)
treea6cd8ae35550564eb75ffad378dd73fe48f878eb
parentabffe25f9d9649da0cb27c5b1d4699b1ef78fb58 (diff)
Don't depend on USER being set in build_nightly as it does not seem to work when build job is run from cron
-rwxr-xr-xbuild_nightly5
-rwxr-xr-xbuild_upload_nightly4
2 files changed, 5 insertions, 4 deletions
diff --git a/build_nightly b/build_nightly
index 3bea61e..6f530d1 100755
--- a/build_nightly
+++ b/build_nightly
@@ -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
diff --git a/build_upload_nightly b/build_upload_nightly
index 7d392c1..aa52cb0 100755
--- a/build_upload_nightly
+++ b/build_upload_nightly
@@ -9,12 +9,12 @@ if [ $? -ne 0 ]; then
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"