diff --git a/Dockerfile b/Dockerfile index dcf5310..c9b49a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \ # Python python3 python3-dev python3-pip \ # Camoufox build system tools - git p7zip-full golang-go aria2 curl \ + git p7zip-full golang-go aria2 curl rsync \ # CA certificates ca-certificates \ && update-ca-certificates @@ -23,10 +23,10 @@ ENV PATH="/root/.cargo/bin:${PATH}" # Fetch Firefox & apply initial patches RUN make setup-minimal && \ make mozbootstrap && \ - mkdir /app/dist + mkdir -p /app/dist # Mount .mozbuild directory and dist folder VOLUME /root/.mozbuild VOLUME /app/dist -ENTRYPOINT ["python3", "./multibuild.py"] +ENTRYPOINT ["python3", "./multibuild.py"] \ No newline at end of file diff --git a/additions/camoucfg/MaskConfig.hpp b/additions/camoucfg/MaskConfig.hpp index 76fc407..28a95a7 100644 --- a/additions/camoucfg/MaskConfig.hpp +++ b/additions/camoucfg/MaskConfig.hpp @@ -44,7 +44,10 @@ inline std::optional get_env_utf8(const std::string& name) { } inline const nlohmann::json& GetJson() { - static const nlohmann::json jsonConfig = []() { + static std::once_flag initFlag; + static nlohmann::json jsonConfig; + + std::call_once(initFlag, []() { std::string jsonString; int index = 1; @@ -63,17 +66,21 @@ inline const nlohmann::json& GetJson() { if (originalConfig) jsonString = *originalConfig; } - if (jsonString.empty()) return nlohmann::json{}; + if (jsonString.empty()) { + jsonConfig = nlohmann::json{}; + return; + } // Validate if (!nlohmann::json::accept(jsonString)) { printf_stderr("ERROR: Invalid JSON passed to CAMOU_CONFIG!\n"); - return nlohmann::json{}; + jsonConfig = nlohmann::json{}; + return; } - nlohmann::json result = nlohmann::json::parse(jsonString); - return result; - }(); + jsonConfig = nlohmann::json::parse(jsonString); + }); + return jsonConfig; } diff --git a/multibuild.py b/multibuild.py index 2fbdc83..e424fae 100644 --- a/multibuild.py +++ b/multibuild.py @@ -22,6 +22,7 @@ import os import sys from dataclasses import dataclass from typing import List +import shutil # Constants AVAILABLE_TARGETS = ["linux", "windows", "macos"] @@ -86,7 +87,7 @@ def run_build(target, arch): # Move assets to dist print('Assets:', ', '.join(builder.assets)) for asset in builder.assets: - os.rename(asset, f'dist/{asset}') + shutil.move(asset, f'dist/{asset}') def main():