Build Ubuntu Live Image #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Ubuntu Live Image | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget syslinux-common pxelinux | |
sudo apt-get install -y build-essential fakeroot libncurses5-dev libssl-dev ccache bison flex libelf-dev libudev-dev libpci-dev libiberty-dev debhelper dpkg-dev debootstrap gpg ubuntu-keyring | |
wget https://ftp.debian.org/debian/pool/main/l/live-build/live-build_20240810_all.deb | |
sudo dpkg -i live-build_20240810_all.deb | |
- name: Configure live-build for Ubuntu Jammy | |
run: | | |
mkdir -p live-build | |
cd live-build | |
lb config \ | |
--distribution jammy \ | |
--debian-installer live \ | |
--debian-installer-distribution jammy \ | |
--archive-areas "main restricted universe multiverse" \ | |
--security true \ | |
--updates true \ | |
--mirror-bootstrap "http://archive.ubuntu.com/ubuntu/" \ | |
--mirror-binary "http://archive.ubuntu.com/ubuntu/" \ | |
--mirror-binary-security "http://security.ubuntu.com/ubuntu/" \ | |
--mirror-debian-installer "http://archive.ubuntu.com/ubuntu/" \ | |
--parent-mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \ | |
--parent-mirror-binary-security "http://security.ubuntu.com/ubuntu/" \ | |
--mirror-chroot-security "http://security.ubuntu.com/ubuntu/" \ | |
--apt-recommends false | |
# Create necessary directories | |
mkdir -p config/packages.chroot config/package-lists config/hooks/normal config/includes.chroot/etc/default | |
# Create package list | |
cat << EOF > config/package-lists/my.list.chroot | |
linux-generic | |
grub-pc | |
EOF | |
# Create GRUB default configuration | |
echo 'GRUB_TIMEOUT=5' > config/includes.chroot/etc/default/grub | |
# Create a hook to update initramfs and install grub-pc | |
cat << EOF > config/hooks/normal/0100-update-initramfs.hook.chroot | |
#!/bin/sh | |
set -e | |
# Ensure /dev, /proc, and /sys are mounted | |
mount -t devtmpfs devtmpfs /dev || true | |
mount -t proc proc /proc || true | |
mount -t sysfs sysfs /sys || true | |
# Update and install packages | |
apt-get update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y linux-generic grub-pc | |
# Update initramfs for all installed kernels | |
update-initramfs -u -k all | |
# Update GRUB configuration | |
update-grub | |
# Unmount the filesystems | |
umount /sys || true | |
umount /proc || true | |
umount /dev || true | |
EOF | |
chmod +x config/hooks/normal/0100-update-initramfs.hook.chroot | |
- name: Build Ubuntu Live ISO | |
run: | | |
cd live-build | |
sudo lb clean | |
sudo lb config | |
sudo lb build | |
continue-on-error: true | |
- name: Check for ISO file | |
run: | | |
if [ -f live-build/live-image-amd64.hybrid.iso ]; then | |
echo "ISO file created successfully" | |
else | |
echo "Error: ISO file not created" | |
ls -R live-build | |
exit 1 | |
fi | |
- name: Upload Live ISO | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ubuntu-noble-live.iso | |
path: live-build/live-image-amd64.hybrid.iso | |
- name: Clean up | |
if: always() | |
run: | | |
cd live-build | |
sudo lb clean | |
sudo rm -rf chroot |