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:
Jakub Sokołowski 2020-04-14 17:33:11 +02:00
parent 5c8a8e83ac
commit 1b43e4c16b
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ export TARGET ?= $(TARGET_OS)
endif
# 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
TMP_BUILD_NUMBER := $(shell ./scripts/version/gen_build_no.sh | cut -c1-10)

View File

@ -31,7 +31,7 @@ KEYSTORE_PATH=$(env_var_or_gradle_prop 'KEYSTORE_PATH')
KEYSTORE_PATH=${KEYSTORE_PATH/#\~/$HOME}
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}"
exit 0
fi
@ -39,7 +39,7 @@ fi
KEYSTORE_DIR=$(dirname "${KEYSTORE_PATH}")
[[ -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 \
-keyalg RSA \

View File

@ -46,14 +46,14 @@ nixOpts+=(
"--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.
# 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.
WATCHMAN_SOCKFILE=$(watchman get-sockname --no-pretty | jq -r .sockname)
nixOpts+=(
" --argstr" "watchmanSockPath" "${WATCHMAN_SOCKFILE}"
" --option" "extra-sandbox-paths" "${KEYSTORE_PATH} ${SECRETS_FILE_PATH} ${WATCHMAN_SOCKFILE}"
"--argstr" "watchmanSockPath" "${WATCHMAN_SOCKFILE}"
"--option" "extra-sandbox-paths" "${KEYSTORE_PATH} ${SECRETS_FILE_PATH} ${WATCHMAN_SOCKFILE}"
)
else
nixOpts+=(