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 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)

View File

@ -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 \

View File

@ -46,7 +46,7 @@ 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.