161 lines
8 KiB
Makefile
161 lines
8 KiB
Makefile
# justfile for creating a Debian "trixie" Calamares installer ISO.
|
|
# This file provides a full set of recipes for configuring, building,
|
|
# and testing the ISO. It assumes you have `just` and `live-build` installed.
|
|
|
|
# Variables for easy configuration.
|
|
DISTRIBUTION := "trixie"
|
|
ARCH := "amd64"
|
|
DEBIAN_MIRROR := "https://ftp.debian.org/debian/"
|
|
|
|
# To use apt-cacher-ng, uncomment the line below and set your proxy address.
|
|
# APT_CACHER_NG_PROXY := "http://172.19.0.2:3142"
|
|
APT_CACHER_NG_PROXY := ""
|
|
|
|
QEMU_ACCEL := "kvm"
|
|
|
|
# Default recipe that runs when you type `just`.
|
|
# It cleans up any previous build and then builds a new ISO.
|
|
default: build-iso
|
|
|
|
# List all available recipes in the justfile.
|
|
list:
|
|
@just --list
|
|
|
|
# Show the current status of the live-build environment.
|
|
status:
|
|
@echo "P: Checking live-build status..."
|
|
@ls -la .build/ 2>/dev/null || echo "No .build directory found"
|
|
@ls -la binary/ 2>/dev/null || echo "No binary directory found"
|
|
|
|
# Initialize the live-build configuration. This is the first step.
|
|
init-live-build:
|
|
@echo "P: Initializing live-build configuration..."
|
|
@echo "P: Using standard mirror: {{DEBIAN_MIRROR}}"
|
|
sudo lb config \
|
|
--architectures {{ARCH}} \
|
|
--distribution {{DISTRIBUTION}} \
|
|
--binary-images iso-hybrid \
|
|
--iso-application "Debian Atomic Desktop Installer" \
|
|
--iso-publisher "Debian Atomic Desktop Project" \
|
|
--iso-volume "Debian Atomic Desktop" \
|
|
--debian-installer live \
|
|
--linux-flavours {{ARCH}} \
|
|
--bootloader syslinux \
|
|
--security false \
|
|
--verbose \
|
|
--apt-options "--option Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled=false" \
|
|
--apt-options "--option Acquire::IndexTargets::deb-src::Contents-deb::DefaultEnabled=false"
|
|
@echo "P: Creating bootstrap hook to force correct mirror and disable Contents..."
|
|
sudo mkdir -p config/hooks
|
|
sudo bash -c 'echo "#!/bin/bash" > config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "set -e" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "echo \"Forcing mirror to {{DEBIAN_MIRROR}} and fixing apt issues in bootstrap stage...\"" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "cat > /etc/apt/sources.list << \"EOF_SOURCES\"" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "deb {{DEBIAN_MIRROR}} trixie main contrib non-free" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "deb-src {{DEBIAN_MIRROR}} trixie main contrib non-free" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "deb {{DEBIAN_MIRROR}} trixie-updates main contrib non-free" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "deb-src {{DEBIAN_MIRROR}} trixie-updates main contrib non-free" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "EOF_SOURCES" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "echo \"Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled \\\"false\\\";\" > /etc/apt/apt.conf.d/99-disable-contents" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo bash -c 'echo "echo \"Bootstrap sources.list forced and Contents disabled successfully.\"" >> config/hooks/00-force-apt-fix.bootstrap'
|
|
sudo chmod +x config/hooks/00-force-apt-fix.bootstrap
|
|
@echo "P: Creating chroot hook as backup to disable Contents..."
|
|
sudo bash -c 'echo "#!/bin/bash" > config/hooks/01-disable-contents.chroot'
|
|
sudo bash -c 'echo "set -e" >> config/hooks/01-disable-contents.chroot'
|
|
sudo bash -c 'echo "echo \"Disabling Contents downloads in chroot stage...\"" >> config/hooks/01-disable-contents.chroot'
|
|
sudo bash -c 'echo "echo \"Acquire::IndexTargets::deb::Contents-deb::DefaultEnabled \\\"false\\\";\" > /etc/apt/apt.conf.d/99-disable-contents" >> config/hooks/01-disable-contents.chroot'
|
|
sudo bash -c 'echo "echo \"Contents downloads disabled in chroot stage.\"" >> config/hooks/01-disable-contents.chroot'
|
|
sudo chmod +x config/hooks/01-disable-contents.chroot
|
|
@echo "P: Creating chroot package files..."
|
|
mkdir -p config/package-lists
|
|
echo "calamares" > config/package-lists/calamares.list.chroot
|
|
echo "network-manager" >> config/package-lists/calamares.list.chroot
|
|
echo "sudo" >> config/package-lists/calamares.list.chroot
|
|
echo "curl" >> config/package-lists/calamares.list.chroot
|
|
echo "wget" >> config/package-lists/calamares.list.chroot
|
|
echo "vim" >> config/package-lists/calamares.list.chroot
|
|
echo "task-xfce-desktop" >> config/package-lists/calamares.list.chroot
|
|
echo "lightdm" >> config/package-lists/calamares.list.chroot
|
|
echo "podman" >> config/package-lists/calamares.list.chroot
|
|
echo "skopeo" >> config/package-lists/calamares.list.chroot
|
|
@if [ -n "{{APT_CACHER_NG_PROXY}}" ]; then \
|
|
echo "P: Configuring apt-cacher-ng for chroot..."; \
|
|
mkdir -p config/chroot_local-setup; \
|
|
echo '#!/bin/sh' > config/chroot_local-setup/99-proxy; \
|
|
echo 'set -e' >> config/chroot_local-setup/99-proxy; \
|
|
echo 'echo "Acquire::http::Proxy \"{{APT_CACHER_NG_PROXY}}\";" > /etc/apt/apt.conf.d/99proxy' >> config/chroot_local-setup/99-proxy; \
|
|
chmod +x config/chroot_local-setup/99-proxy; \
|
|
fi
|
|
@echo "P: Creating Calamares autostart hook..."
|
|
sudo bash -c 'echo "#!/bin/sh" > config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "set -e" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "cat > /etc/systemd/system/calamares-autostart.service << \"EOF2\"" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "[Unit]" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "Description=Starts the Calamares installer on boot" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "Wants=graphical.target" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "After=graphical.target" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "[Service]" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "Type=simple" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "ExecStart=/usr/bin/calamares" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "Restart=no" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "[Install]" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "WantedBy=graphical.target" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "EOF2" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo bash -c 'echo "systemctl enable calamares-autostart.service" >> config/hooks/02-calamares-autostart.chroot'
|
|
sudo chmod +x config/hooks/02-calamares-autostart.chroot
|
|
@echo "P: Live-build initialized and chroot files created."
|
|
|
|
# Update the live-build configuration.
|
|
update-config:
|
|
@echo "P: Updating live-build configuration..."
|
|
just clean-iso
|
|
just init-live-build
|
|
|
|
# Build the bootable ISO with the Calamares installer.
|
|
# This recipe depends on a clean environment and a valid configuration.
|
|
build-iso: clean-all init-live-build
|
|
@echo "P: Starting the live-build process..."
|
|
sudo lb build
|
|
@echo "P: Build complete. The ISO should be in the current directory."
|
|
|
|
# Build with verbose debug output.
|
|
build-iso-debug: clean-all init-live-build
|
|
@echo "P: Starting the live-build process with verbose output..."
|
|
sudo lb build --verbose
|
|
@echo "P: Build complete. The ISO should be in the current directory."
|
|
|
|
# Test the generated ISO in QEMU with console only.
|
|
test-iso:
|
|
@echo "P: Testing ISO in QEMU..."
|
|
qemu-system-x86_64 \
|
|
-enable-kvm \
|
|
-m 2G \
|
|
-cdrom live-image-{{ARCH}}.hybrid.iso \
|
|
-serial mon:stdio \
|
|
-nographic
|
|
|
|
# Test the generated ISO in QEMU with a graphical window.
|
|
test-iso-gui:
|
|
@echo "P: Testing ISO in QEMU with GUI..."
|
|
qemu-system-x86_64 \
|
|
-enable-kvm \
|
|
-m 4G \
|
|
-smp 2 \
|
|
-vga virtio \
|
|
-display sdl,gl=on \
|
|
-cdrom live-image-{{ARCH}}.hybrid.iso
|
|
|
|
# Clean up only the ISO build artifacts, keeping the chroot cache.
|
|
clean-iso:
|
|
@echo "P: Cleaning ISO build artifacts..."
|
|
sudo lb clean --binary
|
|
|
|
# Clean all build artifacts, including the chroot and caches.
|
|
clean-all:
|
|
@echo "P: Cleaning all build artifacts..."
|
|
sudo lb clean --purge
|
|
|
|
# Help recipe (just a duplicate of --list)
|
|
help: list
|