Skip to content

Commit

Permalink
fix: allow empty custom modules dir (#77)
Browse files Browse the repository at this point in the history
Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
  • Loading branch information
RoyalOughtness and gmpinder authored Feb 22, 2024
1 parent 8931a22 commit 681aab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/commands/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ fn get_gitlab_registry_path() -> Option<String> {
)
}

fn modules_exists() -> bool {
let mod_path = Path::new("modules");
mod_path.exists() && mod_path.is_dir()
}

#[derive(Debug, Clone, TypedBuilder, PartialEq, Eq, Hash)]
struct AkmodsInfo {
images: (String, Option<String>),
Expand Down
2 changes: 2 additions & 0 deletions templates/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ COPY ./config /config
# Custom modules overwrite defaults
FROM scratch as stage-modules
COPY --from=ghcr.io/ublue-os/bling:latest /modules /modules
{%- if self::modules_exists() %}
COPY ./modules /modules
{%- endif %}

{%- for info in self::get_akmods_info_list(recipe.modules_ext, os_version) %}
FROM scratch as stage-akmods-{{ info.stage_name }}
Expand Down

0 comments on commit 681aab4

Please sign in to comment.