mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-29 01:09:15 +00:00
scripts: sysctl adjustments in reproducible-builds-android (#6583)
* scripts: sysctl adjustments in reproducible-builds-android * scripts/reproduce-builds-android: better errors and sudo only if sysctl * scripts/reproduce-builds-android: set max_pid var early and fix sysctl
This commit is contained in:
@@ -18,6 +18,7 @@ CMDS="curl git docker"
|
||||
|
||||
INIT_DIR="$PWD"
|
||||
TEMPDIR="$(mktemp -d)"
|
||||
PID_MAX_ORIGINAL="$(sysctl -n kernel.pid_max)"
|
||||
|
||||
ARCHES="${ARCHES:-aarch64 armv7a}"
|
||||
|
||||
@@ -32,6 +33,15 @@ cleanup() {
|
||||
rm -rf -- "${TEMPDIR}"
|
||||
docker rm --force "${CONTAINER_NAME}" 2>/dev/null || :
|
||||
docker image rm "${IMAGE_NAME}" 2>/dev/null || :
|
||||
|
||||
if [ "$(sysctl -n kernel.pid_max)" != "$PID_MAX_ORIGINAL" ]; then
|
||||
printf 'Adjusting kernel.pid_max back to original value...\n'
|
||||
if $SUDO sysctl kernel.pid_max="$PID_MAX_ORIGINAL"; then
|
||||
printf 'Successfully adjusted kernel.pid_max\n'
|
||||
else
|
||||
printf 'Failed to adjust kernel.pid_max. Please set the value manually with: %s sysctl kernel.pid_max=%s\n' "$SUDO" "$PID_MAX_ORIGINAL"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
trap 'cleanup' EXIT INT
|
||||
|
||||
@@ -52,6 +62,19 @@ check() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PID_MAX_ORIGINAL" -gt 65535 ]; then
|
||||
SUDO=$(command -v sudo || command -v doas) || { echo "No sudo or doas"; exit 1; }
|
||||
|
||||
printf 'Adjusting kernel.pid_max value to 65535...\n'
|
||||
|
||||
if $SUDO sysctl kernel.pid_max=65535; then
|
||||
printf 'Successfully adjusted kernel.pid_max\n'
|
||||
else
|
||||
printf 'Failed to adjust kernel.pid_max, aborting.\n'
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
set -u
|
||||
}
|
||||
|
||||
@@ -182,6 +205,9 @@ main() {
|
||||
3) build core library with nix (12-24 hours).
|
||||
4) build APK and compare with downloaded one
|
||||
|
||||
The script will ask for sudo password to adjust kernel.pid_max (needed for armv7a build)
|
||||
and set it back to otiginal value when the build is done.
|
||||
|
||||
Continue?'
|
||||
|
||||
read _
|
||||
|
||||
Reference in New Issue
Block a user