fix Android build on MacOS due to lack of OS var
changes: - Drop use of /dev/stderr, doesn't work on MacOS - Use uname -s instead of $OS which was removed - Remove leading whitespace that fucks with Nix - Check if `/etc/os-release` exists before reading it Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
5c8a8e83ac
commit
1b43e4c16b
2
Makefile
2
Makefile
|
@ -48,7 +48,7 @@ export TARGET ?= $(TARGET_OS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Useful for checking if we are on NixOS
|
# Useful for checking if we are on NixOS
|
||||||
OS_NAME := $(shell awk -F= '/^NAME/{print $2}' /etc/os-release)
|
OS_NAME := $(shell [ -f /etc/os-release ] && awk -F= '/^NAME/{print $2}' /etc/os-release)
|
||||||
|
|
||||||
# Useful for Andoird release builds
|
# Useful for Andoird release builds
|
||||||
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)
|
||||||
|
|
|
@ -31,7 +31,7 @@ KEYSTORE_PATH=$(env_var_or_gradle_prop 'KEYSTORE_PATH')
|
||||||
KEYSTORE_PATH=${KEYSTORE_PATH/#\~/$HOME}
|
KEYSTORE_PATH=${KEYSTORE_PATH/#\~/$HOME}
|
||||||
|
|
||||||
if [[ -e "${KEYSTORE_PATH}" ]]; then
|
if [[ -e "${KEYSTORE_PATH}" ]]; then
|
||||||
echo -e "${YLW}Keystore file already exists:${RST} ${KEYSTORE_PATH}" > /dev/stderr
|
echo -e "${YLW}Keystore file already exists:${RST} ${KEYSTORE_PATH}" >&2
|
||||||
echo "${KEYSTORE_PATH}"
|
echo "${KEYSTORE_PATH}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -39,7 +39,7 @@ fi
|
||||||
KEYSTORE_DIR=$(dirname "${KEYSTORE_PATH}")
|
KEYSTORE_DIR=$(dirname "${KEYSTORE_PATH}")
|
||||||
[[ -d $KEYSTORE_DIR ]] || mkdir -p $KEYSTORE_DIR
|
[[ -d $KEYSTORE_DIR ]] || mkdir -p $KEYSTORE_DIR
|
||||||
|
|
||||||
echo -e "${GRN}Generating keystore...${RST}" > /dev/stderr
|
echo -e "${GRN}Generating keystore...${RST}" >&2
|
||||||
|
|
||||||
keytool -genkey -v \
|
keytool -genkey -v \
|
||||||
-keyalg RSA \
|
-keyalg RSA \
|
||||||
|
|
|
@ -46,14 +46,14 @@ nixOpts+=(
|
||||||
"--argstr" "secrets-file" "${SECRETS_FILE_PATH}"
|
"--argstr" "secrets-file" "${SECRETS_FILE_PATH}"
|
||||||
)
|
)
|
||||||
|
|
||||||
if [[ "$OS" =~ Darwin ]]; then
|
if [[ "$(uname -s)" =~ Darwin ]]; then
|
||||||
# Start a watchman instance if not started already and store its socket path.
|
# Start a watchman instance if not started already and store its socket path.
|
||||||
# In order to get access to the right versions of watchman and jq,
|
# In order to get access to the right versions of watchman and jq,
|
||||||
# we start an ad-hoc nix-shell that imports the packages from nix/nixpkgs-bootstrap.
|
# we start an ad-hoc nix-shell that imports the packages from nix/nixpkgs-bootstrap.
|
||||||
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
|
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
|
||||||
nixOpts+=(
|
nixOpts+=(
|
||||||
" --argstr" "watchmanSockPath" "${WATCHMAN_SOCKFILE}"
|
"--argstr" "watchmanSockPath" "${WATCHMAN_SOCKFILE}"
|
||||||
" --option" "extra-sandbox-paths" "${KEYSTORE_PATH} ${SECRETS_FILE_PATH} ${WATCHMAN_SOCKFILE}"
|
"--option" "extra-sandbox-paths" "${KEYSTORE_PATH} ${SECRETS_FILE_PATH} ${WATCHMAN_SOCKFILE}"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
nixOpts+=(
|
nixOpts+=(
|
||||||
|
|
Loading…
Reference in New Issue