feat(dev): make iso just commands work (#1287)
This commit is contained in:
parent
6156c0cc8e
commit
a0ace61c19
6 changed files with 126 additions and 37 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,5 +1,6 @@
|
|||
*.iso
|
||||
*_flatpaks/flatpaks_with_deps
|
||||
*.iso-CHECKSUM
|
||||
flatpaks_with_deps
|
||||
flatpak.*
|
||||
|
||||
scripts/files/home/ublue-os/*
|
||||
103
Justfile
103
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}}")
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ case $FEDORA_MAJOR_VERSION in
|
|||
39)
|
||||
IMAGE_TAG="gts"
|
||||
;;
|
||||
40)
|
||||
IMAGE_TAG="latest"
|
||||
;;
|
||||
*)
|
||||
IMAGE_TAG="$FEDORA_MAJOR_VERSION"
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -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}"
|
||||
|
|
@ -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}"
|
||||
36
scripts/run-iso.sh
Executable file
36
scripts/run-iso.sh
Executable file
|
|
@ -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
|
||||
Loading…
Reference in a new issue