Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lavabit/magma.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadar Levison <ladar@lavabit.com>2022-04-12 11:02:52 +0300
committerLadar Levison <ladar@lavabit.com>2022-04-12 11:02:52 +0300
commit85be4c6d6f3ee72cd52d34a61dce6c6d6cfbd7b3 (patch)
tree9c900383e746355b840ed6ef908b334cf54c56cf
parent68a23a1ffa31b400458276e09aadea79c66f0615 (diff)
Allow library build jobs value to be specified using an environment variable.
-rw-r--r--dev/install/magmad.install.sh8
-rwxr-xr-xdev/scripts/builders/build.lib.sh23
2 files changed, 21 insertions, 10 deletions
diff --git a/dev/install/magmad.install.sh b/dev/install/magmad.install.sh
index a35935ee..eff5b567 100644
--- a/dev/install/magmad.install.sh
+++ b/dev/install/magmad.install.sh
@@ -326,10 +326,10 @@ printf "tls_random_bytes = 255\n" >> /etc/postfix/main.cf
printf "tls_random_reseed_period = 1800s\n\n" >> /etc/postfix/main.cf
# Postfix size limits.
-printf "body_checks_size_limit = 134217728\n"
-printf "mailbox_size_limit = 0\n"
-printf "message_size_limit = 134217728\n"
-printf "virtual_mailbox_limit = 0\n\n"
+printf "body_checks_size_limit = 134217728\n" >> /etc/postfix/main.cf
+printf "mailbox_size_limit = 0\n" >> /etc/postfix/main.cf
+printf "message_size_limit = 134217728\n" >> /etc/postfix/main.cf
+printf "virtual_mailbox_limit = 0\n\n" >> /etc/postfix/main.cf
# Configure postfix to listen for relays on port 2525, instead of port 25, so postfix won't conflict with a magma installation.
sed -i -e "s/^smtp\([ ]*inet\)/127.0.0.1:2525\1/" /etc/postfix/master.cf
diff --git a/dev/scripts/builders/build.lib.sh b/dev/scripts/builders/build.lib.sh
index f5d618f1..cd9a96a6 100755
--- a/dev/scripts/builders/build.lib.sh
+++ b/dev/scripts/builders/build.lib.sh
@@ -54,15 +54,26 @@ BASE=`pwd -P`
popd > /dev/null
M_BUILD=`readlink -f $0`
-if [ $(command -v nproc) ]; then
- M_JOBS=$(nproc)
-else
- M_JOBS=6
+cd $BASE/../../../lib/
+M_ROOT=`pwd`
+
+# Explicitly control the number of build jobs. If a value is provided, it must be a number.
+if [ -n "$M_JOBS" ] && [ -z "${M_JOBS##*[!0-9]*}" ]; then
+ printf "\nInvalid number of build jobs requested. Using the default value instead.\n"
+ unset M_JOBS
fi
-cd $BASE/../../../lib/
+# If M_JOBS wasn't defined, use nproc to get a CPU count, and use that value. If nproc isn't
+# available, or doesn't provide a number when called, we will use the hard coded value below.
+if [ ! -n "$M_JOBS" ] && [ $(command -v nproc) ]; then
+ M_JOBS=$(nproc)
+ [ -z "${M_JOBS##*[!0-9]*}" ] && unset M_JOBS
+fi
-M_ROOT=`pwd`
+# Use a hard coded value of 6 jobs, if this point is reached without a value.
+if [ ! -n "$M_JOBS" ]; then
+ M_JOBS=6
+fi
# Set parent directory as project root by default (used to find scripts,
# bundled tarballs, patches, etc.)