diff --git a/.gitignore b/.gitignore index 423160ad..cf47e7dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.iso -*_flatpaks/flatpaks_with_deps +*.iso-CHECKSUM +flatpaks_with_deps flatpak.* scripts/files/home/ublue-os/* \ No newline at end of file diff --git a/Justfile b/Justfile index 87392a03..4c1e2d9c 100644 --- a/Justfile +++ b/Justfile @@ -5,73 +5,96 @@ export latest := "40" alias run := run-booted-guest _default: - @just help + @just help _container_mgr: - @{{project_root}}/scripts/container_mgr.sh + @{{ project_root }}/scripts/container_mgr.sh _base_image image: - @{{project_root}}/scripts/base-image.sh {{image}} + @{{ project_root }}/scripts/base-image.sh {{ image }} _tag image target: - @{{project_root}}/scripts/make-tag.sh {{image}} {{target}} + @{{ project_root }}/scripts/make-tag.sh {{ image }} {{ target }} + +# Check Just Syntax +just-check: + #!/usr/bin/bash + find "${project_root}" -type f -name "*.just" | while read -r file; do + echo "Checking syntax: $file" + just --unstable --fmt --check -f $file || { exit 1; } + done + just --unstable --fmt --check -f ${project_root}/Justfile || { exit 1; } + +# Fix Just Syntax +[private] +just-fix: + #!/usr/bin/bash + find "${project_root}" -type f -name "*.just" | while read -r file; do + echo "Checking syntax: $file" + just --unstable --fmt -f $file || { exit 1; } + done + just --unstable --fmt -f ${project_root}/Justfile || { exit 1; } # Build Image build image="" target="" version="": - @{{project_root}}/scripts/build-image.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/build-image.sh {{ image }} {{ target }} {{ version }} # Run image run-container image="" target="" version="": - @{{project_root}}/scripts/run-image.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/run-image.sh {{ image }} {{ target }} {{ version }} # Run Booted Image Session w/ Guest run-booted-guest image="" target="" version="": - @{{project_root}}/scripts/run-booted-guest.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/run-booted-guest.sh {{ image }} {{ target }} {{ version }} # Run Booted Image Session w/ mounted in $USER and $HOME run-booted-home image="" target="" version="": - @{{project_root}}/scripts/run-booted-home.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/run-booted-home.sh {{ image }} {{ target }} {{ version }} # Create ISO from local dev build image build-iso image="" target="" version="": - @{{project_root}}/scripts/build-iso.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/build-iso.sh {{ image }} {{ target }} {{ version }} + +# Run ISO from local dev build image +run-iso image="" target="" version="": + @{{ project_root }}/scripts/run-iso.sh {{ image }} {{ target }} {{ version }} # Create ISO from currenct ghcr image build-iso-ghcr image="" target="" version="": - @{{project_root}}/scripts/build-iso-ghcr.sh {{image}} {{target}} {{version}} + @{{ project_root }}/scripts/build-iso-ghcr.sh {{ image }} {{ target }} {{ version }} # Clean Directory. Remove ISOs and Build Files clean: - @{{project_root}}/scripts/cleanup-dir.sh + @{{ project_root }}/scripts/cleanup-dir.sh # Remove built images clean-images: - @{{project_root}}/scripts/cleanup-images.sh + @{{ project_root }}/scripts/cleanup-images.sh # List Built Images list-images: - @{{project_root}}/scripts/list-images.sh + @{{ project_root }}/scripts/list-images.sh [private] help: - #!/usr/bin/bash - echo " " - echo "These are helper scripts for building and testing development images " - echo " " - echo "You can run dev images either in 'booted like' setup with 'just run-booted' " - echo "Or in a more stripped down version with 'just run' " - echo "Specify which image you wish to build and run by name. " - echo "Example: 'just run-container aurora' -> runs aurora without systemd " - echo "Example: 'just run bluefin-dx' -> runs bluefin-dx with systemd " - echo " " - echo "Helper scripts are in 'project_root/scripts'. " - echo " " - echo "Modify the 'devcontainer.json' in 'project_root/.devcontainer' to support " - echo "Running the devcontainer with podman or docker " - echo "Manually specify container manager with '$CONTAINER_MGR' enviornment variable " - echo " " - just --list - + #!/usr/bin/bash + echo " " + echo "These are helper scripts for building and testing development images " + echo " " + echo "You can run dev images either in 'booted like' setup with 'just run-booted' " + echo "Or in a more stripped down version with 'just run' " + echo "Specify which image you wish to build and run by name. " + echo "Example: 'just run-container aurora' -> runs aurora without systemd " + echo "Example: 'just run bluefin-dx' -> runs bluefin-dx with systemd " + echo " " + echo "Helper scripts are in 'project_root/scripts'. " + echo " " + echo "Modify the 'devcontainer.json' in 'project_root/.devcontainer' to support " + echo "Running the devcontainer with podman or docker " + echo "Manually specify container manager with '$CONTAINER_MGR' enviornment variable " + echo " " + just --list + # Build Bluefin bluefin: (build "bluefin" "base" "{{gts}}") @@ -89,3 +112,21 @@ aurora: (build "aurora" "base" "{{latest}}") # Builed Aurora-DX aurora-dx: (build "aurora" "dx" "{{latest}}") + +# Build Bluefin-ISO +bluefin-iso: (build-iso "bluefin" "base" "{{gts}}") + +# Build Bluefin-DX-ISO +bluefin-dx-iso: (build-iso "bluefin" "dx" "{{gts}}") + +# Build Bluefin Latest-ISO +bluefin-latest-iso: (build-iso "bluefin" "base" "{{latest}}") + +# Build Bluefin-DX Latest-ISO +bluefin-dx-latest-iso: (build-iso "bluefin" "dx" "{{latest}}") + +# Build Aurora-ISO +aurora-iso: (build-iso "aurora" "base" "{{latest}}") + +# Builed Aurora-DX-ISO +aurora-dx-iso: (build-iso "aurora" "dx" "{{latest}}") diff --git a/build_files/shared/image-info.sh b/build_files/shared/image-info.sh index 2e9c1e30..6af5884b 100755 --- a/build_files/shared/image-info.sh +++ b/build_files/shared/image-info.sh @@ -9,6 +9,9 @@ case $FEDORA_MAJOR_VERSION in 39) IMAGE_TAG="gts" ;; + 40) + IMAGE_TAG="latest" + ;; *) IMAGE_TAG="$FEDORA_MAJOR_VERSION" ;; diff --git a/scripts/build-iso-ghcr.sh b/scripts/build-iso-ghcr.sh index 0a8955ab..68fe07f9 100755 --- a/scripts/build-iso-ghcr.sh +++ b/scripts/build-iso-ghcr.sh @@ -10,7 +10,8 @@ fi . "${project_root}/scripts/common-build-iso.sh" # Make ISO -${container_mgr} run --rm --privileged --volume "${workspace}":/build-container-installer/build \ +${container_mgr} run --rm --privileged \ + --volume "${workspace}"/scripts/files/output:/build-container-installer/build \ ghcr.io/jasonn3/build-container-installer:latest \ ARCH="x86_64" \ ENABLE_CACHE_DNF="false" \ @@ -21,7 +22,7 @@ ${container_mgr} run --rm --privileged --volume "${workspace}":/build-container- IMAGE_NAME="${ghcr_tag}" \ IMAGE_REPO="ghcr.io/ublue-os" \ IMAGE_TAG="${version}" \ - ISO_NAME="${ghcr_tag}-${version}-ghcr.iso" \ + ISO_NAME="build/${ghcr_tag}-${version}-ghcr.iso" \ SECURE_BOOT_KEY_URL='https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' \ VARIANT="${variant}" \ VERSION="${version}" \ No newline at end of file diff --git a/scripts/build-iso.sh b/scripts/build-iso.sh index 6923cd40..affe135b 100755 --- a/scripts/build-iso.sh +++ b/scripts/build-iso.sh @@ -9,10 +9,17 @@ fi # shellcheck disable=SC1091 . "${project_root}/scripts/common-build-iso.sh" +if [[ ${container_mgr} =~ "podman" ]]; then + api_socket=/run/podman/podman.sock +elif [[ ${container_mgr} =~ "docker" ]]; then + api_socket=/var/run/docker.sock +fi + # Make ISO ${container_mgr} run --rm --privileged \ - --volume "${workspace}"/scripts/files/build-iso-makefile-patch:/build-container-intaller/container/Makefile \ - --volume "${workspace}":/build-container-installer/build \ + --volume "${api_socket}":/var/run/docker.sock \ + --volume "${workspace}"/scripts/files/build-iso-makefile-patch:/build-container-installer/container/Makefile \ + --volume "${workspace}"/scripts/files/output:/build-container-installer/build \ ghcr.io/jasonn3/build-container-installer:latest \ ARCH="x86_64" \ ENABLE_CACHE_DNF="false" \ @@ -23,7 +30,7 @@ ${container_mgr} run --rm --privileged \ IMAGE_NAME="${tag}" \ IMAGE_REPO="localhost" \ IMAGE_TAG="${version}" \ - ISO_NAME="${tag}-${version}.iso" \ + ISO_NAME="build/${tag}-${version}.iso" \ SECURE_BOOT_KEY_URL='https://github.com/ublue-os/akmods/raw/main/certs/public_key.der' \ VARIANT="${variant}" \ VERSION="${version}" \ No newline at end of file diff --git a/scripts/run-iso.sh b/scripts/run-iso.sh new file mode 100755 index 00000000..246794a4 --- /dev/null +++ b/scripts/run-iso.sh @@ -0,0 +1,36 @@ +#!/usr/bin/bash +if [[ -z ${project_root} ]]; then + project_root=$(git rev-parse --show-toplevel) +fi +set -eo pipefail + +# Get Inputs +image=$1 +target=$2 +version=$3 + +# Get image/target/version based on inputs +# shellcheck disable=SC2154,SC1091 +. "${project_root}/scripts/get-defaults.sh" + +# Get variables +container_mgr=$(just _container_mgr) +tag=$(just _tag "${image}" "${target}") + +#check if ISO exists. Create if it doesn't +if [[ ! -f "${project_root}/scripts/files/output/${tag}-${version}.iso" ]]; then + just build-iso "$image" "$target" "$version" +fi + +workspace=${project_root} +if [[ -f /.dockerenv ]]; then + workspace=${LOCAL_WORKSPACE_FOLDER} +fi + +${container_mgr} run --rm --cap-add NET_ADMIN \ + --publish 127.0.0.1:8006:8006 \ + --env "DISK_SIZE=50G" \ + --env "BOOT_MODE=uefi" \ + --device=/dev/kvm \ + --volume "${workspace}/scripts/files/output/${tag}-${version}.iso":/boot.iso \ + docker.io/qemux/qemu-docker \ No newline at end of file