mirror of
https://github.com/ironfox-oss/IronFox.git
synced 2026-07-31 18:07:06 -04:00
fix: move certain core functions to utilities.sh
Reduces a lot of duplicate logic and adds more validation/verification checks Signed-off-by: celenity <celenity@celenity.dev>
This commit is contained in:
@@ -517,223 +517,71 @@ if [[ "${IRONFOX_NAME}" != 'IronFox' ]] && [[ "${IRONFOX_NAME}" != 'IronFox Nigh
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_BUILD+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_BUILD is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_BUILD}" ]]; then
|
||||
echo_red_text "ERROR: Build directory (${IRONFOX_BUILD}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_BUILD is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_TEMP+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_TEMP is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_TEMP}" ]]; then
|
||||
echo_red_text "ERROR: Temporary directory (${IRONFOX_TEMP}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_TEMP is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_TEMPLATES+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_TEMPLATES is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_TEMPLATES}" ]]; then
|
||||
echo_red_text "ERROR: Templates directory (${IRONFOX_TEMPLATES}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_TEMPLATES is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
# Verify core directories
|
||||
verify_dir_with_env "${IRONFOX_BUILD}" 'IRONFOX_BUILD'
|
||||
verify_dir_with_env "${IRONFOX_TEMP}" 'IRONFOX_TEMP'
|
||||
verify_dir_with_env "${IRONFOX_TEMPLATES}" 'IRONFOX_TEMPLATES'
|
||||
|
||||
# Fail early if our source directories are missing...
|
||||
|
||||
# mozilla-central
|
||||
if [[ "${IRONFOX_BUILD_GECKO}" == 1 ]] || [[ "${IRONFOX_BUILD_GECKOVIEW}" == 1 ]] || [[ "${IRONFOX_BUILD_AC_CORE}" == 1 ]] ||
|
||||
[[ "${IRONFOX_BUILD_AC}" == 1 ]] || [[ "${IRONFOX_BUILD_FENIX}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_GECKO+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GECKO is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_GECKO}" ]]; then
|
||||
echo_red_text "ERROR: mozilla-central (${IRONFOX_GECKO}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GECKO is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_MOZCONFIGS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_MOZCONFIGS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_MOZCONFIGS}" ]]; then
|
||||
echo_red_text "ERROR: The IronFox mozconfigs directory (${IRONFOX_MOZCONFIGS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_MOZCONFIGS is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_GECKO}" 'IRONFOX_GECKO'
|
||||
verify_dir_with_env "${IRONFOX_MOZCONFIGS}" 'IRONFOX_MOZCONFIGS'
|
||||
fi
|
||||
|
||||
# Android Components
|
||||
if [[ "${IRONFOX_BUILD_AC_CORE}" == 1 ]] || [[ "${IRONFOX_BUILD_AC}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_AC+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_AC is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_AC}" ]]; then
|
||||
echo_red_text "ERROR: Android Components (${IRONFOX_AC}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_AC is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_AC}" 'IRONFOX_AC'
|
||||
fi
|
||||
|
||||
# Fenix
|
||||
if [[ "${IRONFOX_BUILD_FENIX}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_FENIX+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_FENIX is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_FENIX}" ]]; then
|
||||
echo_red_text "ERROR: Fenix (${IRONFOX_FENIX}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_FENIX is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_FENIX}" 'IRONFOX_FENIX'
|
||||
fi
|
||||
|
||||
# l10n-central
|
||||
if [[ "${IRONFOX_BUILD_GECKO}" == 1 ]]; then
|
||||
# CI only needs l10n-central if we're producing a bundle...
|
||||
if [[ "${IRONFOX_CI}" == 1 ]] && [[ "${IRONFOX_TARGET_ARCH}" == 'bundle' ]]; then
|
||||
if [[ -z "${IRONFOX_L10N_CENTRAL+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_L10N_CENTRAL is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_L10N_CENTRAL}" ]]; then
|
||||
echo_red_text "ERROR: l10n-central (${IRONFOX_L10N_CENTRAL}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_L10N_CENTRAL is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_L10N_CENTRAL}" 'IRONFOX_L10N_CENTRAL'
|
||||
fi
|
||||
fi
|
||||
|
||||
# microG
|
||||
if [[ "${IRONFOX_BUILD_MICROG}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_GMSCORE+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GMSCORE is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_GMSCORE}" ]]; then
|
||||
echo_red_text "ERROR: microG (${IRONFOX_GMSCORE}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GMSCORE is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_GMSCORE}" 'IRONFOX_GMSCORE'
|
||||
fi
|
||||
|
||||
# Phoenix
|
||||
if [[ "${IRONFOX_BUILD_PHOENIX}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_PHOENIX+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PHOENIX is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_PHOENIX}" ]]; then
|
||||
echo_red_text "ERROR: Phoenix (${IRONFOX_PHOENIX}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_PHOENIX is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_PHOENIX}" 'IRONFOX_PHOENIX'
|
||||
fi
|
||||
|
||||
# Application Services
|
||||
if [[ "${IRONFOX_BUILD_AS}" == 1 ]] || [[ "${IRONFOX_BUILD_NIMBUS_FML}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_AS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_AS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_AS}" ]]; then
|
||||
echo_red_text "ERROR: Application Services (${IRONFOX_AS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_AS is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_AS}" 'IRONFOX_AS'
|
||||
fi
|
||||
|
||||
# UnifiedPush-AC
|
||||
if [[ "${IRONFOX_BUILD_UP_AC}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_UP_AC+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_UP_AC is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_UP_AC}" ]]; then
|
||||
echo_red_text "ERROR: UnifiedPush-AC (${IRONFOX_UP_AC}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_UP_AC is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_UP_AC}" 'IRONFOX_UP_AC'
|
||||
fi
|
||||
|
||||
# Glean
|
||||
if [[ "${IRONFOX_BUILD_GLEAN}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_GLEAN+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GLEAN is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_GLEAN}" ]]; then
|
||||
echo_red_text "ERROR: Glean (${IRONFOX_GLEAN}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GLEAN is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_GLEAN}" 'IRONFOX_GLEAN'
|
||||
fi
|
||||
|
||||
# Prebuilds repo
|
||||
if [[ "${IRONFOX_BUILD_UNIFFI}" == 1 ]] || [[ "${IRONFOX_BUILD_WASI}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_PREBUILDS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PREBUILDS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_PREBUILDS}" ]]; then
|
||||
echo_red_text "ERROR: The IronFox prebuilds repository (${IRONFOX_PREBUILDS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_PREBUILDS is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_PREBUILDS}" 'IRONFOX_PREBUILDS'
|
||||
fi
|
||||
|
||||
# Bundletool
|
||||
if [[ "${IRONFOX_BUILD_BUNDLETOOL}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_BUNDLETOOL_DIR+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_BUNDLETOOL_DIR is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_BUNDLETOOL_DIR}" ]]; then
|
||||
echo_red_text "ERROR: Bundletool (${IRONFOX_BUNDLETOOL_DIR}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_BUNDLETOOL_DIR is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_BUNDLETOOL_DIR}" 'IRONFOX_BUNDLETOOL_DIR'
|
||||
if [[ -z "${IRONFOX_BUNDLETOOL_JAR+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_BUNDLETOOL_JAR is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
@@ -744,186 +592,44 @@ fi
|
||||
# Now, fail early if our build dependencies are missing...
|
||||
|
||||
# Android NDK
|
||||
if [[ -z "${IRONFOX_ANDROID_NDK+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_ANDROID_NDK is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_ANDROID_NDK}" ]]; then
|
||||
echo_red_text "ERROR: Android NDK (${IRONFOX_ANDROID_NDK}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_ANDROID_NDK is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_ANDROID_NDK}" 'IRONFOX_ANDROID_NDK'
|
||||
|
||||
# Android SDK
|
||||
if [[ -z "${IRONFOX_ANDROID_SDK+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_ANDROID_SDK is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_ANDROID_SDK}" ]]; then
|
||||
echo_red_text "ERROR: Android SDK (${IRONFOX_ANDROID_SDK}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_ANDROID_SDK is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_ANDROID_SDK}" 'IRONFOX_ANDROID_SDK'
|
||||
|
||||
# Android SDK Build Tools
|
||||
if [[ -z "${IRONFOX_ANDROID_SDK_BUILD_TOOLS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_ANDROID_SDK_BUILD_TOOLS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_ANDROID_SDK_BUILD_TOOLS}" ]]; then
|
||||
echo_red_text "ERROR: Android SDK Build Tools (${IRONFOX_ANDROID_SDK_BUILD_TOOLS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_ANDROID_SDK_BUILD_TOOLS is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_ANDROID_SDK_BUILD_TOOLS}" 'IRONFOX_ANDROID_SDK_BUILD_TOOLS'
|
||||
|
||||
# Android SDK Platform Tools
|
||||
if [[ -z "${IRONFOX_ANDROID_SDK_PLATFORM_TOOLS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_ANDROID_SDK_PLATFORM_TOOLS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_ANDROID_SDK_PLATFORM_TOOLS}" ]]; then
|
||||
echo_red_text "ERROR: Android SDK Platform Tools (${IRONFOX_ANDROID_SDK_PLATFORM_TOOLS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_ANDROID_SDK_PLATFORM_TOOLS is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_ANDROID_SDK_PLATFORM_TOOLS}" 'IRONFOX_ANDROID_SDK_PLATFORM_TOOLS'
|
||||
|
||||
# GNU awk
|
||||
if [[ -z "${IRONFOX_AWK+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_AWK is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_AWK}" 'IRONFOX_AWK'
|
||||
|
||||
# GNU date
|
||||
if [[ -z "${IRONFOX_DATE+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_DATE is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_DATE}" 'IRONFOX_DATE'
|
||||
|
||||
# GNU sed
|
||||
if [[ -z "${IRONFOX_SED+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_SED is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_SED}" 'IRONFOX_SED'
|
||||
|
||||
# Gradle
|
||||
if [[ -z "${IRONFOX_GRADLE+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GRADLE is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IRONFOX_GRADLE_PY+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GRADLE_PY is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_GRADLE}" 'IRONFOX_GRADLE'
|
||||
verify_file_with_env "${IRONFOX_GRADLE_PY}" 'IRONFOX_GRADLE_PY'
|
||||
if [[ -z "${IRONFOX_GRADLE_FLAGS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GRADLE_FLAGS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_GRADLE}" ]]; then
|
||||
echo_red_text "ERROR: Gradle (${IRONFOX_GRADLE}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GRADLE is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_GRADLE}" ]]; then
|
||||
echo_red_text "ERROR: Gradle (${IRONFOX_GRADLE}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_GRADLE is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_GRADLE}" ]]; then
|
||||
echo_red_text "ERROR: Gradle (${IRONFOX_GRADLE}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_GRADLE is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_GRADLE_PY}" ]]; then
|
||||
echo_red_text "ERROR: Gradle (${IRONFOX_GRADLE_PY}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GRADLE_PY is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_GRADLE_PY}" ]]; then
|
||||
echo_red_text "ERROR: Gradle (${IRONFOX_GRADLE_PY}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_GRADLE_PY is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Java
|
||||
if [[ -z "${IRONFOX_JAVA_HOME+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_JAVA_HOME is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IRONFOX_JAVA+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_JAVA is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_JAVA_HOME}" ]]; then
|
||||
echo_red_text "ERROR: JDK (${IRONFOX_JAVA_HOME}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_JAVA_HOME is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_JAVA}" ]]; then
|
||||
echo_red_text "ERROR: Java (${IRONFOX_JAVA}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_JAVA is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_JAVA}" ]]; then
|
||||
echo_red_text "ERROR: Java (${IRONFOX_JAVA}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_JAVA is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_JAVA}" ]]; then
|
||||
echo_red_text "ERROR: Java (${IRONFOX_JAVA}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_JAVA is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_JAVA_HOME}" 'IRONFOX_JAVA_HOME'
|
||||
verify_exec "${IRONFOX_JAVA}" 'IRONFOX_JAVA'
|
||||
|
||||
## Java 21
|
||||
if [[ -z "${IRONFOX_JDK_21_HOME+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_JDK_21_HOME is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_JDK_21_HOME}" ]]; then
|
||||
echo_red_text "ERROR: JDK 21 (${IRONFOX_JDK_21_HOME}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_JDK_21_HOME is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_JDK_21_HOME}" 'IRONFOX_JDK_21_HOME'
|
||||
|
||||
## Java 17
|
||||
if [[ -z "${IRONFOX_JDK_17_HOME+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_JDK_17_HOME is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_JDK_17_HOME}" ]]; then
|
||||
echo_red_text "ERROR: JDK 17 (${IRONFOX_JDK_17_HOME}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_JDK_17_HOME is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_JDK_17_HOME}" 'IRONFOX_JDK_17_HOME'
|
||||
|
||||
readonly JAVA_VER=$("${IRONFOX_JAVA}" -version 2>&1 | "${IRONFOX_AWK}" -F '"' '/version/ {print $2}' | "${IRONFOX_AWK}" -F '.' '{sub("^$", "0", $2); print $1$2}')
|
||||
[[ "${JAVA_VER}" -ge 15 ]] || {
|
||||
@@ -933,274 +639,44 @@ readonly JAVA_VER=$("${IRONFOX_JAVA}" -version 2>&1 | "${IRONFOX_AWK}" -F '"' '/
|
||||
}
|
||||
|
||||
# Node.js
|
||||
if [[ -z "${IRONFOX_NODEJS+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_NODEJS is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_NODEJS}" ]]; then
|
||||
echo_red_text "ERROR: Node.js (${IRONFOX_NODEJS}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_NODEJS is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_NODEJS}" ]]; then
|
||||
echo_red_text "ERROR: Node.js (${IRONFOX_NODEJS}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_NODEJS is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_NODEJS}" ]]; then
|
||||
echo_red_text "ERROR: Node.js (${IRONFOX_NODEJS}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_NODEJS is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_NODEJS}" 'IRONFOX_NODEJS'
|
||||
|
||||
# npm
|
||||
if [[ -z "${IRONFOX_NPM+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_NPM is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_NPM}" ]]; then
|
||||
echo_red_text "ERROR: npm (${IRONFOX_NPM}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_NPM is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_NPM}" ]]; then
|
||||
echo_red_text "ERROR: npm (${IRONFOX_NPM}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_NPM is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_NPM}" ]]; then
|
||||
echo_red_text "ERROR: npm (${IRONFOX_NPM}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_NPM is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_NPM}" 'IRONFOX_NPM'
|
||||
|
||||
# nvm
|
||||
if [[ -z "${IRONFOX_NVM+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_NVM is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IRONFOX_NVM_ENV+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_NVM_ENV is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_NVM}" ]]; then
|
||||
echo_red_text "ERROR: nvm (${IRONFOX_NVM}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_NVM is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_NVM_ENV}" ]]; then
|
||||
echo_red_text "ERROR: nvm environment activation file (${IRONFOX_NVM_ENV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_NVM_ENV is set to a valid file.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_NVM_ENV}" ]]; then
|
||||
echo_red_text "ERROR: nvm environment activation file (${IRONFOX_NVM_ENV}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_NVM_ENV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_NVM}" 'IRONFOX_NVM'
|
||||
verify_file_with_env "${IRONFOX_NVM_ENV}" 'IRONFOX_NVM_ENV'
|
||||
|
||||
# Python
|
||||
if [[ -z "${IRONFOX_PYTHON+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PYTHON is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_PYTHON}" ]]; then
|
||||
echo_red_text "ERROR: Python (${IRONFOX_PYTHON}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_PYTHON is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_PYTHON}" ]]; then
|
||||
echo_red_text "ERROR: Python (${IRONFOX_PYTHON}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_PYTHON is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_PYTHON}" ]]; then
|
||||
echo_red_text "ERROR: Python (${IRONFOX_PYTHON}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_PYTHON is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_PYTHON}" 'IRONFOX_PYTHON'
|
||||
|
||||
# Python (uv) environment
|
||||
if [[ -z "${IRONFOX_PYENV_DIR+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PYENV_DIR is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IRONFOX_PYENV+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PYENV is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_PYENV_DIR}" ]]; then
|
||||
echo_red_text "ERROR: Python (uv) environment (${IRONFOX_PYENV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_PYENV_DIR is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_PYENV}" ]]; then
|
||||
echo_red_text "ERROR: Python (uv) environment activation file (${IRONFOX_PYENV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_PYENV is set to a valid file.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_PYENV}" ]]; then
|
||||
echo_red_text "ERROR: Python (uv) environment activation file (${IRONFOX_PYENV}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_PYENV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_PYENV_DIR}" 'IRONFOX_PYENV_DIR'
|
||||
verify_file_with_env "${IRONFOX_PYENV}" 'IRONFOX_PYENV'
|
||||
|
||||
## uv
|
||||
if [[ -z "${IRONFOX_UV+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_PYENV is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_UV}" ]]; then
|
||||
echo_red_text "ERROR: uv (${IRONFOX_UV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_UV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_UV}" ]]; then
|
||||
echo_red_text "ERROR: uv (${IRONFOX_UV}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_UV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_UV}" ]]; then
|
||||
echo_red_text "ERROR: uv (${IRONFOX_UV}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_UV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_UV}" 'IRONFOX_UV'
|
||||
|
||||
# uv local directory
|
||||
if [[ -z "${IRONFOX_UV_LOCAL+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_UV_LOCAL is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_UV_LOCAL}" ]]; then
|
||||
echo_red_text "ERROR: uv local directory (${IRONFOX_UV_LOCAL}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_UV_LOCAL is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_UV_LOCAL}" 'IRONFOX_UV_LOCAL'
|
||||
|
||||
# Rust (cargo) environment
|
||||
if [[ -z "${IRONFOX_CARGO_HOME+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_CARGO_HOME is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${IRONFOX_CARGO_ENV+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_CARGO_ENV is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_CARGO_HOME}" ]]; then
|
||||
echo_red_text "ERROR: Rust (cargo) environment (${IRONFOX_CARGO_HOME}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_CARGO_HOME is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_CARGO_ENV}" ]]; then
|
||||
echo_red_text "ERROR: Rust (cargo) environment activation file (${IRONFOX_CARGO_ENV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_CARGO_ENV is set to a valid file.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_CARGO_ENV}" ]]; then
|
||||
echo_red_text "ERROR: Rust (cargo) environment activation file (${IRONFOX_CARGO_ENV}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_CARGO_ENV is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_CARGO_HOME}" 'IRONFOX_CARGO_HOME'
|
||||
verify_file_with_env "${IRONFOX_CARGO_ENV}" 'IRONFOX_CARGO_ENV'
|
||||
|
||||
## cargo
|
||||
if [[ -z "${IRONFOX_CARGO+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_CARGO is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_CARGO}" ]]; then
|
||||
echo_red_text "ERROR: cargo (${IRONFOX_CARGO}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_CARGO is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_CARGO}" ]]; then
|
||||
echo_red_text "ERROR: cargo (${IRONFOX_CARGO}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_CARGO is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_CARGO}" ]]; then
|
||||
echo_red_text "ERROR: cargo (${IRONFOX_CARGO}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_CARGO is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_CARGO}" 'IRONFOX_CARGO'
|
||||
|
||||
# mach
|
||||
if [[ "${IRONFOX_BUILD_GECKO}" == 1 ]] || [[ "${IRONFOX_BUILD_GECKOVIEW}" == 1 ]] || [[ "${IRONFOX_BUILD_AC_CORE}" == 1 ]] ||
|
||||
[[ "${IRONFOX_BUILD_AC}" == 1 ]] || [[ "${IRONFOX_BUILD_FENIX}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_MACH+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_MACH is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${IRONFOX_MACH}" ]]; then
|
||||
echo_red_text "ERROR: mach (${IRONFOX_MACH}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_MACH is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "${IRONFOX_MACH}" ]]; then
|
||||
echo_red_text "ERROR: mach (${IRONFOX_MACH}) is empty!"
|
||||
echo 'Please ensure that IRONFOX_MACH is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -x "${IRONFOX_MACH}" ]]; then
|
||||
echo_red_text "ERROR: mach (${IRONFOX_MACH}) is not executable!"
|
||||
echo 'Please ensure that IRONFOX_MACH is set to a valid executable.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_exec "${IRONFOX_MACH}" 'IRONFOX_MACH'
|
||||
fi
|
||||
|
||||
# Glean's Python (uv) environment
|
||||
if [[ "${IRONFOX_BUILD_GLEAN}" == 1 ]]; then
|
||||
if [[ -z "${IRONFOX_GLEAN_PYENV+x}" ]]; then
|
||||
echo_red_text 'ERROR: IRONFOX_GLEAN_PYENV is missing!'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -d "${IRONFOX_GLEAN_PYENV}" ]]; then
|
||||
echo_red_text "ERROR: Glean's Python (uv) environment (${IRONFOX_GLEAN_PYENV}) is missing!"
|
||||
echo 'Please ensure that IRONFOX_GLEAN_PYENV is set to a valid directory.'
|
||||
echo_red_text 'Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
verify_dir_with_env "${IRONFOX_GLEAN_PYENV}" 'IRONFOX_GLEAN_PYENV'
|
||||
fi
|
||||
|
||||
# Safe Browsing API key
|
||||
@@ -1273,10 +749,6 @@ if [[ -z "${GLEAN_VERSION+x}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set timezone to UTC for consistency
|
||||
unset TZ
|
||||
export TZ="UTC"
|
||||
|
||||
# Functions
|
||||
|
||||
# Set-up our build environment
|
||||
@@ -1930,40 +1402,13 @@ function _build_gecko() {
|
||||
# If we're producing a bundle, we need to prepare to assemble our fat AAR
|
||||
if [[ "${target_arch}" == 'bundle' ]]; then
|
||||
# Verify that our ARM64 GeckoView AAR archive exists
|
||||
if [[ ! -f "${IRONFOX_GECKOVIEW_AAR_ARM64}" ]]; then
|
||||
echo_red_text "ERROR: ARM64 GeckoView AAR archive not found! (${IRONFOX_GECKOVIEW_AAR_ARM64})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify that our ARM64 GeckoView AAR archive is not an empty file
|
||||
if [[ ! -s "${IRONFOX_GECKOVIEW_AAR_ARM64}" ]]; then
|
||||
echo_red_text "ERROR: ARM64 GeckoView AAR archive is empty! (${IRONFOX_GECKOVIEW_AAR_ARM64})"
|
||||
exit 1
|
||||
fi
|
||||
verify_file_with_env "${IRONFOX_GECKOVIEW_AAR_ARM64}" 'IRONFOX_GECKOVIEW_AAR_ARM64'
|
||||
|
||||
# Verify that our ARM GeckoView AAR archive exists
|
||||
if [[ ! -f "${IRONFOX_GECKOVIEW_AAR_ARM}" ]]; then
|
||||
echo_red_text "ERROR: ARM GeckoView AAR archive not found! (${IRONFOX_GECKOVIEW_AAR_ARM})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify that our ARM GeckoView AAR archive is not an empty file
|
||||
if [[ ! -s "${IRONFOX_GECKOVIEW_AAR_ARM}" ]]; then
|
||||
echo_red_text "ERROR: ARM GeckoView AAR archive is empty! (${IRONFOX_GECKOVIEW_AAR_ARM})"
|
||||
exit 1
|
||||
fi
|
||||
verify_file_with_env "${IRONFOX_GECKOVIEW_AAR_ARM}" 'IRONFOX_GECKOVIEW_AAR_ARM'
|
||||
|
||||
# Verify that our x86_64 GeckoView AAR archive exists
|
||||
if [[ ! -f "${IRONFOX_GECKOVIEW_AAR_X86_64}" ]]; then
|
||||
echo_red_text "ERROR: x86_64 GeckoView AAR archive not found! (${IRONFOX_GECKOVIEW_AAR_X86_64})"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify that our x86_64 GeckoView AAR archive is not an empty file
|
||||
if [[ ! -s "${IRONFOX_GECKOVIEW_AAR_X86_64}" ]]; then
|
||||
echo_red_text "ERROR: x86_64 GeckoView AAR archive is empty! (${IRONFOX_GECKOVIEW_AAR_X86_64})"
|
||||
exit 1
|
||||
fi
|
||||
verify_file_with_env "${IRONFOX_GECKOVIEW_AAR_X86_64}" 'IRONFOX_GECKOVIEW_AAR_X86_64'
|
||||
|
||||
if [[ -z "${MOZ_ANDROID_FAT_AAR_ARCHITECTURES+x}" ]]; then
|
||||
readonly MOZ_ANDROID_FAT_AAR_ARCHITECTURES='arm64-v8a,armeabi-v7a,x86_64'
|
||||
|
||||
@@ -51,15 +51,7 @@ esac
|
||||
|
||||
if [[ "${ci_build_project}" == 'fenix' ]]; then
|
||||
# Fail-fast in case the signing key is unavailable or empty file
|
||||
if [[ ! -f "${IRONFOX_ANDROID_KEYSTORE}" ]]; then
|
||||
echo_red_text "ERROR: Keystore file ${IRONFOX_ANDROID_KEYSTORE} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_ANDROID_KEYSTORE}" ]]; then
|
||||
echo_red_text "ERROR: Keystore file ${IRONFOX_ANDROID_KEYSTORE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
verify_file_with_env "${IRONFOX_ANDROID_KEYSTORE}" 'IRONFOX_ANDROID_KEYSTORE'
|
||||
fi
|
||||
|
||||
# Get sources
|
||||
|
||||
@@ -20,93 +20,11 @@ source "$(realpath $(dirname "$0"))/env.sh"
|
||||
# Include utilities
|
||||
source "${IRONFOX_UTILS}"
|
||||
|
||||
if [[ -z "${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_ACCESS_KEY_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_ACCESS_KEY_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 access key file not found! (${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_RELEASES_S3_ACCESS_KEY_FILE environment variable is set to the correct path in which the key file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 access key file ${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_BUCKET_NAME_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_BUCKET_NAME_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file not found! (${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_RELEASES_S3_BUCKET_NAME_FILE environment variable is set to the correct path in which the bucket name file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file ${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_ENDPOINT_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_ENDPOINT_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 endpoint file not found! (${IRONFOX_RELEASES_S3_ENDPOINT_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_RELEASES_S3_ENDPOINT_FILE environment variable is set to the correct path in which the endpoint file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file ${IRONFOX_RELEASES_S3_ENDPOINT_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_SECRET_KEY_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_SECRET_KEY_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 secret key file not found! (${IRONFOX_RELEASES_S3_SECRET_KEY_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_RELEASES_S3_SECRET_KEY_FILE environment variable is set to the correct path in which the key file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 secret key file ${IRONFOX_RELEASES_S3_SECRET_KEY_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
# Verify secrets
|
||||
verify_file_with_env "${IRONFOX_RELEASES_S3_ACCESS_KEY_FILE}" 'IRONFOX_RELEASES_S3_ACCESS_KEY_FILE'
|
||||
verify_file_with_env "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" 'IRONFOX_RELEASES_S3_BUCKET_NAME_FILE'
|
||||
verify_file_with_env "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" 'IRONFOX_RELEASES_S3_ENDPOINT_FILE'
|
||||
verify_file_with_env "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" 'IRONFOX_RELEASES_S3_SECRET_KEY_FILE'
|
||||
|
||||
readonly GENERIC_PACKAGES_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic"
|
||||
|
||||
@@ -119,20 +37,30 @@ function upload_to_package_registry() {
|
||||
"${GENERIC_PACKAGES_URL}/${upload_package_name}/${IRONFOX_VERSION}/${upload_file_name}"
|
||||
}
|
||||
|
||||
function upload_to_s3() {
|
||||
local readonly upload_file="$1"
|
||||
# Pushes a file to S3
|
||||
function push_to_s3() {
|
||||
function print_usage() {
|
||||
echo "Usage: push_to_s3 '/path/to/file' 'path/on/s3'"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the path to a file that should be uploaded to S3 storage'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${2+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the target path on S3 storage for where the file should be uploaded'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly push_file="$1"
|
||||
local readonly s3_path="$2"
|
||||
local readonly s3_full_path="${s3_path}/$("${IRONFOX_BASENAME}" "${upload_file}")"
|
||||
|
||||
if [[ ! -f "${upload_file}" ]]; then
|
||||
echo_red_text "ERROR: File ${upload_file} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${upload_file}" ]]; then
|
||||
echo_red_text "ERROR: File ${upload_file} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
# Ensure our file to push is valid
|
||||
verify_file "${push_file}"
|
||||
|
||||
# Set our MIME type
|
||||
case "${upload_file}" in
|
||||
@@ -159,14 +87,20 @@ function upload_to_s3() {
|
||||
local readonly s3_endpoint=$("${IRONFOX_CAT}" "${IRONFOX_RELEASES_S3_ENDPOINT_FILE}" | "${IRONFOX_XARGS}")
|
||||
local readonly s3_secret_key=$("${IRONFOX_CAT}" "${IRONFOX_RELEASES_S3_SECRET_KEY_FILE}" | "${IRONFOX_XARGS}")
|
||||
|
||||
echo_red_text "Uploading ${upload_file} to S3..."
|
||||
if [[ "${s3_path}" == 'root' ]]; then
|
||||
local readonly s3_target_path="s3://${s3_bucket_name}"
|
||||
else
|
||||
local readonly s3_target_path="s3://${s3_bucket_name}/${s3_full_path}"
|
||||
fi
|
||||
|
||||
echo_red_text "Pushing ${push_file} to S3..."
|
||||
source "${IRONFOX_PYENV}"
|
||||
"${IRONFOX_S3CMD}" ${IRONFOX_S3CMD_FLAGS} --mime-type="${mime_type}" put "${upload_file}" "s3://${s3_bucket_name}/${s3_full_path}" \
|
||||
"${IRONFOX_S3CMD}" ${IRONFOX_S3CMD_FLAGS} --mime-type="${mime_type}" put "${push_file}" "${s3_target_path}" \
|
||||
--access_key="${s3_access_key}" \
|
||||
--secret_key="${s3_secret_key}" \
|
||||
--host="${s3_endpoint}" \
|
||||
--host-bucket="${s3_endpoint}"
|
||||
echo_green_text "SUCCESS: Uploaded ${upload_file} to S3"
|
||||
echo_green_text "SUCCESS: Pushed ${push_file} to S3"
|
||||
}
|
||||
|
||||
function add_sha512sum() {
|
||||
@@ -190,7 +124,7 @@ function add_sha512sum() {
|
||||
local readonly local_sha512sum=$("${IRONFOX_SHA512SUM}" "${sha512sum_file_in}" | "${IRONFOX_AWK}" '{print $1}')
|
||||
echo -n "${local_sha512sum}" > "${sha512sum_file_out}"
|
||||
|
||||
upload_to_s3 "${sha512sum_file_out}" "${sha512sum_s3path}"
|
||||
push_to_s3 "${sha512sum_file_out}" "${sha512sum_s3path}"
|
||||
}
|
||||
|
||||
# Extract compressed artifacts
|
||||
@@ -223,7 +157,7 @@ function upload_asset() {
|
||||
echo "\`\`\`" >> "${CHECKSUMS_FILE}"
|
||||
echo '' >> "${CHECKSUMS_FILE}"
|
||||
upload_to_package_registry "${asset_file}" "${asset_package_name}"
|
||||
upload_to_s3 "${asset_file}" "${asset_s3_path}"
|
||||
push_to_s3 "${asset_file}" "${asset_s3_path}"
|
||||
add_sha512sum "${asset_file}" "${asset_s3_path}"
|
||||
}
|
||||
|
||||
@@ -282,7 +216,7 @@ readonly IRONFOX_BUNDLE_SHA512SUM=$("${IRONFOX_SHA512SUM}" "${IRONFOX_APKS_ARTIF
|
||||
"${IRONFOX_SED}" -i "s|{IRONFOX_UNIVERSAL_SHA512SUM}|${IRONFOX_UNIVERSAL_SHA512SUM}|" "${IRONFOX_ROOT}/updates.json"
|
||||
"${IRONFOX_SED}" -i "s|{IRONFOX_BUNDLE_SHA512SUM}|${IRONFOX_BUNDLE_SHA512SUM}|" "${IRONFOX_ROOT}/updates.json"
|
||||
|
||||
upload_to_s3 "${IRONFOX_ROOT}/updates.json" 'ironfox/releases'
|
||||
push_to_s3 "${IRONFOX_ROOT}/updates.json" 'ironfox/releases'
|
||||
|
||||
# Because we now upload all releases to releases.ironfoxoss.org, we only want to keep the last 3 releases in ex. F-Droid
|
||||
## In order to do so, we need to store/upload the current and prior 2 versions of IronFox as text files
|
||||
@@ -293,13 +227,13 @@ echo -n "${IRONFOX_VERSION}" > "${IRONFOX_ROOT}/latest_release.txt"
|
||||
"${IRONFOX_CP}" "${IRONFOX_ROOT}/current-latest_release.txt" "${IRONFOX_ROOT}/previous_release.txt"
|
||||
"${IRONFOX_CP}" "${IRONFOX_ROOT}/current-previous_release.txt" "${IRONFOX_ROOT}/previous_previous_release.txt"
|
||||
|
||||
upload_to_s3 "${IRONFOX_ROOT}/latest_release.txt" 'ironfox/releases'
|
||||
push_to_s3 "${IRONFOX_ROOT}/latest_release.txt" 'ironfox/releases'
|
||||
add_sha512sum "${IRONFOX_ROOT}/latest_release.txt" 'ironfox/releases'
|
||||
|
||||
upload_to_s3 "${IRONFOX_ROOT}/previous_release.txt" 'ironfox/releases'
|
||||
push_to_s3 "${IRONFOX_ROOT}/previous_release.txt" 'ironfox/releases'
|
||||
add_sha512sum "${IRONFOX_ROOT}/previous_release.txt" 'ironfox/releases'
|
||||
|
||||
upload_to_s3 "${IRONFOX_ROOT}/previous_release.txt" 'ironfox/releases'
|
||||
push_to_s3 "${IRONFOX_ROOT}/previous_release.txt" 'ironfox/releases'
|
||||
add_sha512sum "${IRONFOX_ROOT}/previous_previous_release.txt" 'ironfox/releases'
|
||||
|
||||
{
|
||||
|
||||
@@ -19,93 +19,11 @@ if [[ -z "${IRONFOX_FROM_AR_UP+x}" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 access key file not found! (${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE environment variable is set to the correct path in which the key file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 access key file ${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_RELEASES_S3_BUCKET_NAME_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_RELEASES_S3_BUCKET_NAME_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file not found! (${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE environment variable is set to the correct path in which the bucket name file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file ${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 endpoint file not found! (${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE environment variable is set to the correct path in which the endpoint file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 bucket name file ${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" == 'null' ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE environment variable has not been specified! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text 'ERROR: The IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE environment variable is missing! Aborting...'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 secret key file not found! (${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE})"
|
||||
echo_green_text "Please ensure the IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE environment variable is set to the correct path in which the key file is located."
|
||||
echo_red_text "Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" ]]; then
|
||||
echo_red_text "ERROR: S3 secret key file ${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
# Verify secrets
|
||||
verify_file_with_env "${IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE}" 'IRONFOX_ARTIFACTS_S3_ACCESS_KEY_FILE'
|
||||
verify_file_with_env "${IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE}" 'IRONFOX_ARTIFACTS_S3_BUCKET_NAME_FILE'
|
||||
verify_file_with_env "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" 'IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE'
|
||||
verify_file_with_env "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" 'IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE'
|
||||
|
||||
readonly up_artifact="$1"
|
||||
|
||||
@@ -140,35 +58,6 @@ if [[ "${up_arch}" != 'arm64' ]] && [[ "${up_arch}" != 'arm' ]] && [[ "${up_arch
|
||||
fi
|
||||
readonly IRONFOX_AR_UP_ARCH="${up_arch}"
|
||||
|
||||
# Set timezone to UTC for consistency
|
||||
unset TZ
|
||||
export TZ="UTC"
|
||||
|
||||
# Verifies that a file exists and is not empty
|
||||
function verify_file() {
|
||||
function print_usage() {
|
||||
echo "Usage: verify_file '/path/to/file'"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the path to a file to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly file_to_verify="$1"
|
||||
|
||||
if [[ ! -f "${file_to_verify}" ]]; then
|
||||
echo_red_text "ERROR: File ${file_to_verify} does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${file_to_verify}" ]]; then
|
||||
echo_red_text "ERROR: File ${file_to_verify} is empty!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Pushes a file to S3
|
||||
function push_file() {
|
||||
function print_usage() {
|
||||
@@ -225,9 +114,15 @@ function push_file() {
|
||||
local readonly s3_endpoint=$("${IRONFOX_CAT}" "${IRONFOX_ARTIFACTS_S3_ENDPOINT_FILE}" | "${IRONFOX_XARGS}")
|
||||
local readonly s3_secret_key=$("${IRONFOX_CAT}" "${IRONFOX_ARTIFACTS_S3_SECRET_KEY_FILE}" | "${IRONFOX_XARGS}")
|
||||
|
||||
if [[ "${s3_path}" == 'root' ]]; then
|
||||
local readonly s3_target_path="s3://${s3_bucket_name}/ironfox"
|
||||
else
|
||||
local readonly s3_target_path="s3://${s3_bucket_name}/ironfox/${s3_full_path}"
|
||||
fi
|
||||
|
||||
echo_red_text "Uploading ${push_file} to S3..."
|
||||
source "${IRONFOX_PYENV}"
|
||||
"${IRONFOX_S3CMD}" ${IRONFOX_S3CMD_FLAGS} --mime-type="${mime_type}" put "${push_file}" "s3://${s3_bucket_name}/ironfox/${s3_full_path}" \
|
||||
"${IRONFOX_S3CMD}" ${IRONFOX_S3CMD_FLAGS} --mime-type="${mime_type}" put "${push_file}" "${s3_target_path}" \
|
||||
--access_key="${s3_access_key}" \
|
||||
--secret_key="${s3_secret_key}" \
|
||||
--host="${s3_endpoint}" \
|
||||
@@ -324,15 +219,15 @@ if [[ "${IRONFOX_AR_UP_FENIX}" == 1 ]]; then
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_AR_UP_GECKOVIEW}" == 1 ]]; then
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'arm64' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_ARM64}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'arm64' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_ARM64}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'arm' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_ARM}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'arm' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_ARM}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'x86_64' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_X86_64}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
if [[ "${IRONFOX_AR_UP_ARCH}" == 'x86_64' ]]; then
|
||||
push_and_add_sha512sum "${IRONFOX_OUTPUTS_GECKOVIEW_AAR_X86_64}" "${CI_PIPELINE_ID}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -89,6 +89,7 @@ if [[ -z "${IRONFOX_SET_ENVS+x}" ]]; then
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_PWD}" "${IRONFOX_PATH}/pwd"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_PYTHON}" "${IRONFOX_PATH}/python"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_PYTHON}" "${IRONFOX_PATH}/python3"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_PYTHON}" "${IRONFOX_PATH}/python3.14"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_REALPATH}" "${IRONFOX_PATH}/realpath"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_RM}" "${IRONFOX_PATH}/rm"
|
||||
"${IRONFOX_LN}" -sf "${IRONFOX_RMDIR}" "${IRONFOX_PATH}/rmdir"
|
||||
|
||||
@@ -175,6 +175,10 @@ function apply_overlay() {
|
||||
|
||||
function prepare_ac() {
|
||||
echo_red_text 'Preparing Android Components...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_AC}" 'IRONFOX_AC'
|
||||
verify_dir_with_env "${IRONFOX_AC_OVERLAY}" 'IRONFOX_AC_OVERLAY'
|
||||
|
||||
pushd "${IRONFOX_AC}"
|
||||
|
||||
@@ -265,6 +269,9 @@ function prepare_ac() {
|
||||
function prepare_android_sdk() {
|
||||
echo_red_text 'Preparing Android SDK...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_ANDROID_SDK}" 'IRONFOX_ANDROID_SDK'
|
||||
|
||||
# Create Android NDK symlink
|
||||
if [[ ! -d "${IRONFOX_ANDROID_SDK}/ndk/${ANDROID_NDK_REVISION}" ]]; then
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_ANDROID_SDK}/ndk"
|
||||
@@ -292,6 +299,10 @@ function prepare_android_sdk() {
|
||||
function prepare_as() {
|
||||
echo_red_text 'Preparing Application Services...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_AS}" 'IRONFOX_AS'
|
||||
verify_dir_with_env "${IRONFOX_AS_OVERLAY}" 'IRONFOX_AS_OVERLAY'
|
||||
|
||||
pushd "${IRONFOX_AS}"
|
||||
|
||||
# Check patches
|
||||
@@ -379,6 +390,9 @@ function prepare_as() {
|
||||
function prepare_bundletool() {
|
||||
echo_red_text 'Preparing Bundletool...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_BUNDLETOOL_DIR}" 'IRONFOX_BUNDLETOOL_DIR'
|
||||
|
||||
pushd "${IRONFOX_BUNDLETOOL_DIR}"
|
||||
|
||||
# Always use our Gradle wrapper with our Gradle flags/configuration
|
||||
@@ -395,6 +409,11 @@ function prepare_bundletool() {
|
||||
function prepare_fenix() {
|
||||
echo_red_text 'Preparing Fenix...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_FENIX}" 'IRONFOX_FENIX'
|
||||
verify_dir_with_env "${IRONFOX_FENIX_OVERLAY}" 'IRONFOX_FENIX_OVERLAY'
|
||||
verify_dir_with_env "${IRONFOX_UP_AC}" 'IRONFOX_UP_AC'
|
||||
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/fenix/app/src/main/res"
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/fenix/app/src/release/res/values"
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/fenix/app/src/release/res/xml"
|
||||
@@ -642,6 +661,10 @@ function prepare_fenix() {
|
||||
function prepare_firefox() {
|
||||
echo_red_text 'Preparing Firefox...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_GECKO}" 'IRONFOX_GECKO'
|
||||
verify_dir_with_env "${IRONFOX_GECKO_OVERLAY}" 'IRONFOX_GECKO_OVERLAY'
|
||||
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/gecko/ironfox"
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/gecko/toolkit/content/neterror/supportpages"
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_MOZBUILD}"
|
||||
@@ -886,6 +909,10 @@ function prepare_firefox() {
|
||||
function prepare_glean() {
|
||||
echo_red_text 'Preparing Glean...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_GLEAN}" 'IRONFOX_GLEAN'
|
||||
verify_dir_with_env "${IRONFOX_GLEAN_OVERLAY}" 'IRONFOX_GLEAN_OVERLAY'
|
||||
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_GLEAN_PYENV}/bootstrap-24.3.0-0"
|
||||
"${IRONFOX_MKDIR}" -p "${IRONFOX_TEMP}/glean"
|
||||
|
||||
@@ -999,6 +1026,9 @@ function prepare_llvm() {
|
||||
function prepare_microg() {
|
||||
echo_red_text 'Preparing microG...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_GMSCORE}" 'IRONFOX_GMSCORE'
|
||||
|
||||
pushd "${IRONFOX_GMSCORE}"
|
||||
|
||||
# Apply patches
|
||||
@@ -1028,6 +1058,9 @@ function prepare_microg() {
|
||||
function prepare_prebuilds() {
|
||||
echo_red_text 'Preparing IronFox prebuilds...'
|
||||
|
||||
# Verify directories
|
||||
verify_dir_with_env "${IRONFOX_PREBUILDS}" 'IRONFOX_PREBUILDS'
|
||||
|
||||
pushd "${IRONFOX_PREBUILDS}"
|
||||
/bin/bash "${IRONFOX_PREBUILDS}/scripts/prebuild.sh"
|
||||
popd
|
||||
|
||||
@@ -22,6 +22,9 @@ function sign_apk() {
|
||||
local readonly apk_in="$1"
|
||||
local readonly apk_out="$2"
|
||||
|
||||
# Ensure the APK to sign exists
|
||||
verify_file "${apk_in}"
|
||||
|
||||
"${IRONFOX_APKSIGNER}" sign \
|
||||
--ks="${IRONFOX_ANDROID_KEYSTORE}" \
|
||||
--ks-pass="file:/${IRONFOX_ANDROID_KEYSTORE_PASS_FILE}" \
|
||||
@@ -34,6 +37,9 @@ function sign_apk() {
|
||||
function sign_bundle() {
|
||||
echo_red_text 'Building signed bundleset...'
|
||||
|
||||
# Ensure the AAB to sign exists
|
||||
verify_file_with_env "${IRONFOX_OUTPUTS_BUNDLE_AAB}" 'IRONFOX_OUTPUTS_BUNDLE_AAB'
|
||||
|
||||
# Create our output directory
|
||||
"${IRONFOX_MKDIR}" -p $("${IRONFOX_DIRNAME}" "${IRONFOX_OUTPUTS_BUNDLE}")
|
||||
|
||||
|
||||
@@ -12,3 +12,147 @@ function echo_red_text() {
|
||||
function echo_green_text() {
|
||||
echo -e "\033[32m$1\033[0m"
|
||||
}
|
||||
|
||||
# Verify that an executable (corresponding to an environment variable) exists and is properly set-up
|
||||
function verify_exec() {
|
||||
function print_usage() {
|
||||
echo "Usage: verify_exec /path/to/executable 'ENVIRONMENT_VARIABLE_FOR_EXECUTABLE'"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify an executable!'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${2+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify an environment variable that corresponds to an executable!'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly exec="$1"
|
||||
local readonly exec_env="$2"
|
||||
|
||||
if [[ -z "${exec_env+x}" ]]; then
|
||||
echo_red_text "ERROR: Environment variable is missing!: ${exec_env}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${exec}" ]]; then
|
||||
echo_red_text "ERROR: ${exec} is missing!"
|
||||
echo_green_text "Please ensure that environment variable is set to a valid executable: ${exec_env}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${exec}" ]]; then
|
||||
echo_red_text "ERROR: ${exec} is empty!"
|
||||
echo_green_text "Please ensure that environment variable is set to a valid executable: ${exec_env}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -x "${exec}" ]]; then
|
||||
echo_red_text "ERROR: ${exec} is not executable!"
|
||||
echo_green_text "Please ensure that environment variable is set to a valid executable: ${exec_env}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Verify that a file exists and is not empty
|
||||
function verify_file() {
|
||||
function print_usage() {
|
||||
echo "Usage: verify_file /path/to/file"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the path to a file to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly verify_file="$1"
|
||||
|
||||
if [[ ! -f "${verify_file}" ]]; then
|
||||
echo_red_text "ERROR: ${verify_file} does not exist! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${verify_file}" ]]; then
|
||||
echo_red_text "ERROR: ${verify_file} is empty! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Verify that a file (corresponding to an environment variable) exists and is not empty
|
||||
function verify_file_with_env() {
|
||||
function print_usage() {
|
||||
echo "Usage: verify_file_with_env /path/to/file 'ENVIRONMENT_VARIABLE_FOR_FILE'"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the path to a file to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${2+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the environment variable that corresponds to the file to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly verify_file="$1"
|
||||
local readonly verify_file_env="$2"
|
||||
|
||||
if [[ -z "${verify_file_env+x}" ]]; then
|
||||
echo_red_text "ERROR: Environment variable is missing!: ${verify_file_env}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${verify_file}" == 'null' ]]; then
|
||||
echo_red_text "ERROR: Environment variable: ${verify_file_env} has not been specified! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${verify_file}" ]]; then
|
||||
echo_red_text "ERROR: ${verify_file_env} is set, but ${verify_file} does not exist! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -s "${verify_file}" ]]; then
|
||||
echo_red_text "ERROR: ${verify_file_env} is set, but ${verify_file} is empty! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Verify that a directory (corresponding to an environment variable) exists
|
||||
function verify_dir_with_env() {
|
||||
function print_usage() {
|
||||
echo "Usage: verify_dir_with_env /path/to/dir 'ENVIRONMENT_VARIABLE_FOR_DIR'"
|
||||
}
|
||||
|
||||
if [[ -z "${1+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the path to a directory to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "${2+x}" ]]; then
|
||||
echo_red_text 'ERROR: Please specify the environment variable that corresponds to the directory to verify'
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local readonly verify_dir="$1"
|
||||
local readonly verify_dir_env="$2"
|
||||
|
||||
if [[ -z "${verify_file_env+x}" ]]; then
|
||||
echo_red_text "ERROR: Environment variable is missing!: ${verify_dir_env}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "${verify_dir}" ]]; then
|
||||
echo_red_text "ERROR: ${verify_dir_env} is set, but ${verify_dir} does not exist! Aborting..."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user