diff --git a/flake.nix b/flake.nix index f137118..0828ff7 100644 --- a/flake.nix +++ b/flake.nix @@ -63,7 +63,6 @@ rustc bacon earthly - yq jq nixpkgs-fmt ]; diff --git a/scripts/pre_build.sh b/scripts/pre_build.sh new file mode 100644 index 0000000..4a58aa0 --- /dev/null +++ b/scripts/pre_build.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if ! command -v jq > /dev/null; then + rpm-ostree install jq +fi + +ostree container commit diff --git a/scripts/setup.sh b/scripts/setup.sh index fcb7509..b8d7563 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -6,14 +6,14 @@ if [ -f /etc/os-release ]; then if [ "$ID" = "alpine" ]; then echo "Setting up Alpine based image to run BlueBuild modules" apk update - apk add --no-cache bash curl coreutils wget grep + apk add --no-cache bash curl coreutils wget grep jq elif [ "$ID" = "ubuntu" ] || [ "$ID" = "debian" ]; then echo "Setting up Ubuntu based image to run BlueBuild modules" apt-get update - apt-get install -y bash curl coreutils wget + apt-get install -y bash curl coreutils wget jq elif [ "$ID" = "fedora" ]; then echo "Settig up Fedora based image to run BlueBuild modules" - dnf install -y --refresh bash curl wget coreutils + dnf install -y --refresh bash curl wget coreutils jq else echo "OS not detected, proceeding without setup" fi diff --git a/template/templates/Containerfile.j2 b/template/templates/Containerfile.j2 index bdcf0b9..1880e8f 100644 --- a/template/templates/Containerfile.j2 +++ b/template/templates/Containerfile.j2 @@ -36,6 +36,9 @@ RUN --mount=type=bind,from=stage-bins,src=/bins,dst=/tmp/bins \ && cp /tmp/bins/* /usr/bin/ \ && ostree container commit +RUN --mount=type=bind,from={{ build_scripts_image }},src=/scripts/,dst=/scripts/ \ + /scripts/pre_build.sh + {% call modules::main_modules_run(recipe.modules_ext, os_version) %} RUN --mount=type=bind,from={{ build_scripts_image }},src=/scripts/,dst=/scripts/ \