diff options
| author | R0flcopt3r <12752060+R0flcopt3r@users.noreply.github.com> | 2025-03-17 01:15:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-16 21:15:55 -0300 |
| commit | e0e4a78dfbe3a1a054a7e1342eac68430c529d96 (patch) | |
| tree | c44ae22d2a645532d49579f4893edb636074fba7 /Justfile | |
| parent | f1d14428d11a562a537942bc6e2fed8bcea60a70 (diff) | |
| download | AeroCore-OS-e0e4a78dfbe3a1a054a7e1342eac68430c529d96.tar.gz AeroCore-OS-e0e4a78dfbe3a1a054a7e1342eac68430c529d96.zip | |
feat: build in tempdir and move files on success (#82)
* feat: build in tempdir and move files on success
Before it would delete your outputs before starting the build. That
means miss-typing the command for example could lead to losing data.
This also creates separate folders for each type to avoid collision.
* fix: tempdir naming
this follows the convention set in the `_rootful_load_image` target.
* fix: delete output folder in clean target
* fix: move contents of temp build directory
This ensures a flatter folder structure, bib allready seem to ensure
there aren't any file name collisions.
output folder would look like this after building a raw and qcow2.
output
├── image
│ └── disk.raw
├── manifest-qcow2.json
├── manifest-raw.json
└── qcow2
└── disk.qcow2
* fix: overwrite previous output directory
From conversations in https://github.com/ublue-os/image-template/pull/82
this is the wanted behaviour for this project.
* revert: overwrite previous output directory
This reverts commit 75448d72fa624cea01524d5651c926ae772460bf.
* chore(gitignore): ensure build directories are not showing up on diffs
---------
Co-authored-by: Tulip Blossom <tulilirockz@proton.me>
Diffstat (limited to 'Justfile')
| -rw-r--r-- | Justfile | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -45,6 +45,7 @@ clean: rm -f previous.manifest.json rm -f changelog.md rm -f output.env + rm -f output/ # Sudo Clean Repo [group('Utility')] @@ -186,15 +187,6 @@ _build-bib $target_image $tag $type $config: (_rootful_load_image target_image t #!/usr/bin/env bash set -euo pipefail - mkdir -p "output" - - echo "Cleaning up previous build" - if [[ $type == iso ]]; then - sudo rm -rf "output/bootiso" || true - else - sudo rm -rf "output/${type}" || true - fi - args="--type ${type} " args+="--use-librepo=True" @@ -202,6 +194,8 @@ _build-bib $target_image $tag $type $config: (_rootful_load_image target_image t args+=" --local" fi + BUILDTMP=$(mktemp -p "${PWD}" -d -t _build-bib.XXXXXXXXXX) + sudo podman run \ --rm \ -it \ @@ -210,13 +204,16 @@ _build-bib $target_image $tag $type $config: (_rootful_load_image target_image t --net=host \ --security-opt label=type:unconfined_t \ -v $(pwd)/${config}:/config.toml:ro \ - -v $(pwd)/output:/output \ + -v $BUILDTMP:/output \ -v /var/lib/containers/storage:/var/lib/containers/storage \ "${bib_image}" \ ${args} \ "${target_image}:${tag}" - sudo chown -R $USER:$USER output + mkdir -p output + sudo mv -f $BUILDTMP/* output/ + sudo rmdir $BUILDTMP + sudo chown -R $USER:$USER output/ # Podman builds the image from the Containerfile and creates a bootable image # Parameters: |
