Skip to content

Commit 699e79b

Browse files
authored
Add support for new Ubuntu installer, subiquity (#188)
1 parent 7d0fdc8 commit 699e79b

5 files changed

Lines changed: 184 additions & 125 deletions

File tree

.github/workflows/CI.yml

Lines changed: 20 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ on:
55
[push, workflow_dispatch]
66

77
jobs:
8+
ISO:
9+
strategy:
10+
matrix:
11+
target:
12+
- image: ubuntu
13+
- image: kubuntu
14+
#- image: ubuntu-unity
815

9-
ISO-Kubuntu:
1016
runs-on: ubuntu-latest
1117
steps:
1218
- uses: actions/checkout@v6
@@ -26,11 +32,13 @@ jobs:
2632
echo Version is ${VER}-${REL}
2733
echo "kver=${VER}" >> $GITHUB_ENV
2834
echo "isotag=${VER}-${REL}" >> $GITHUB_ENV
35+
CAPS=$(echo "${{ matrix.target.image }}" | tr '_-' ' ' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2); print}')
36+
echo "caps=${CAPS}" >> $GITHUB_ENV
2937
3038
- name: Run build script
3139
run: |
3240
chmod +x ${{ github.workspace }}/build_in_docker.sh
33-
${{ github.workspace }}/build_in_docker.sh kubuntu
41+
${{ github.workspace }}/build_in_docker.sh ${{ matrix.target.image }}
3442
3543
- name: print sha256sum
3644
run: |
@@ -41,15 +49,15 @@ jobs:
4149
- name: Upload package artifact
4250
uses: actions/upload-artifact@v7
4351
with:
44-
name: ISO-Kubuntu
45-
path: ${{ github.workspace }}/output/kubuntu-25.10-${{ env.kver }}-t2-questing.iso
52+
name: ISO-${{ matrix.target.image }}
53+
path: ${{ github.workspace }}/output/${{ matrix.target.image }}-25.10-${{ env.kver }}-t2-questing.iso
4654
archive: false
4755

4856
- name: Remove unsplit ISO
4957
run: |
5058
sudo rm ${{ github.workspace }}/output/*.iso
5159
- name: Release
52-
if: github.ref == 'refs/heads/flavourMainline'
60+
if: github.ref == 'refs/heads/mainline'
5361
uses: softprops/action-gh-release@v2
5462
with:
5563
files: ${{ github.workspace }}/output/*
@@ -61,17 +69,17 @@ jobs:
6169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6270

6371
- name: Update the json
64-
if: github.ref == 'refs/heads/flavourMainline'
72+
if: github.ref == 'refs/heads/mainline'
6573
run: |
6674
git clone https://github.com/t2linux/wiki.git
6775
cd wiki/docs/tools
6876
6977
cat << EOF > update.py
7078
import json
7179
# Define the new links
72-
new_link1 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/kubuntu-25.10-${{ env.kver }}-t2-questing.iso.00"
73-
new_link2 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/kubuntu-25.10-${{ env.kver }}-t2-questing.iso.01"
74-
new_link3 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/kubuntu-25.10-${{ env.kver }}-t2-questing.iso.02"
80+
new_link1 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/${{ matrix.target.image }}-25.10-${{ env.kver }}-t2-questing.iso.00"
81+
new_link2 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/${{ matrix.target.image }}-25.10-${{ env.kver }}-t2-questing.iso.01"
82+
new_link3 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/${{ matrix.target.image }}-25.10-${{ env.kver }}-t2-questing.iso.02"
7583
# Load the JSON file
7684
with open('distro-metadata.json', 'r') as file:
7785
data = json.load(file)
@@ -82,7 +90,7 @@ jobs:
8290
distro['iso'] = new_links
8391
distro['sha256'] = sha256
8492
# Update the links
85-
update_links(data['all'], "Kubuntu 25.10 - Questing Quokka", [new_link1, new_link2, new_link3], "${{ env.sha256 }}")
93+
update_links(data['all'], "${{ env.caps }} 25.10 - Questing Quokka", [new_link1, new_link2, new_link3], "${{ env.sha256 }}")
8694
# Save the updated JSON back to the file
8795
with open('distro-metadata.json', 'w') as file:
8896
json.dump(data, file, indent=2)
@@ -94,7 +102,7 @@ jobs:
94102
cd -
95103
96104
- name: Push updated links to t2linux.org
97-
if: github.ref == 'refs/heads/flavourMainline'
105+
if: github.ref == 'refs/heads/mainline'
98106
uses: cpina/github-action-push-to-another-repository@main
99107
env:
100108
API_TOKEN_GITHUB: ${{ secrets.PAT }}
@@ -105,105 +113,4 @@ jobs:
105113
user-email: github-actions[bot]@users.noreply.github.com
106114
user-name: github-actions[bot]
107115
target-branch: master
108-
commit-message: Distro metadata - Update Kubuntu 25.10 to v${{ env.isotag }}
109-
110-
ISO-Ubuntu-Unity:
111-
runs-on: ubuntu-latest
112-
steps:
113-
- uses: actions/checkout@v6
114-
115-
- name: Free up disk space for the CI
116-
uses: AdityaGarg8/remove-unwanted-software@v5
117-
with:
118-
remove-android: 'true'
119-
remove-dotnet: 'true'
120-
remove-haskell: 'true'
121-
122-
- name: Generate Tag
123-
id: tag
124-
run: |
125-
VER=$(egrep ^KERNEL_VERSION build.sh|cut -d= -f2)
126-
REL=$(egrep ^PKGREL build.sh|cut -d= -f2)
127-
echo Version is ${VER}-${REL}
128-
echo "kver=${VER}" >> $GITHUB_ENV
129-
echo "isotag=${VER}-${REL}" >> $GITHUB_ENV
130-
131-
- name: Run build script
132-
run: |
133-
chmod +x ${{ github.workspace }}/build_in_docker.sh
134-
${{ github.workspace }}/build_in_docker.sh ubuntu-unity
135-
136-
- name: print sha256sum
137-
run: |
138-
cat ${{ github.workspace }}/output/sha256*
139-
SHA256=$(cat ${{ github.workspace }}/output/sha256* | cut -d " " -f 1)
140-
echo "sha256=${SHA256}" >> $GITHUB_ENV
141-
142-
- name: Upload package artifact
143-
uses: actions/upload-artifact@v7
144-
with:
145-
name: ISO-Ubuntu-Unity
146-
path: ${{ github.workspace }}/output/ubuntu-unity-25.10-${{ env.kver }}-t2-questing.iso
147-
archive: false
148-
149-
- name: Remove unsplit ISO
150-
run: |
151-
sudo rm ${{ github.workspace }}/output/*.iso
152-
- name: Release
153-
if: github.ref == 'refs/heads/flavourMainline'
154-
uses: softprops/action-gh-release@v2
155-
with:
156-
files: ${{ github.workspace }}/output/*
157-
tag_name: v${{ env.isotag }}
158-
#body_path: ${{ github.workspace }}/.github/workflows/instructions.txt
159-
draft: false
160-
prerelease: false
161-
env:
162-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163-
164-
- name: Update the json
165-
if: github.ref == 'refs/heads/flavourMainline'
166-
run: |
167-
git clone https://github.com/t2linux/wiki.git
168-
cd wiki/docs/tools
169-
170-
cat << EOF > update.py
171-
import json
172-
# Define the new links
173-
new_link1 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/ubuntu-unity-25.10-${{ env.kver }}-t2-questing.iso.00"
174-
new_link2 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/ubuntu-unity-25.10-${{ env.kver }}-t2-questing.iso.01"
175-
new_link3 = "https://github.com/t2linux/T2-Ubuntu/releases/download/v${{ env.isotag }}/ubuntu-unity-25.10-${{ env.kver }}-t2-questing.iso.02"
176-
# Load the JSON file
177-
with open('distro-metadata.json', 'r') as file:
178-
data = json.load(file)
179-
# Function to update the links
180-
def update_links(distros, name, new_links, sha256):
181-
for distro in distros:
182-
if distro['name'] == name:
183-
distro['iso'] = new_links
184-
distro['sha256'] = sha256
185-
# Update the links
186-
update_links(data['all'], "Ubuntu Unity 25.10 - Questing Quokka", [new_link1, new_link2, new_link3], "${{ env.sha256 }}")
187-
# Save the updated JSON back to the file
188-
with open('distro-metadata.json', 'w') as file:
189-
json.dump(data, file, indent=2)
190-
print("Links updated successfully.")
191-
EOF
192-
193-
python3 update.py
194-
rm update.py
195-
cd -
196-
197-
- name: Push updated links to t2linux.org
198-
if: github.ref == 'refs/heads/flavourMainline'
199-
uses: cpina/github-action-push-to-another-repository@main
200-
env:
201-
API_TOKEN_GITHUB: ${{ secrets.PAT }}
202-
with:
203-
source-directory: 'wiki'
204-
destination-github-username: 't2linux'
205-
destination-repository-name: 'wiki'
206-
user-email: github-actions[bot]@users.noreply.github.com
207-
user-name: github-actions[bot]
208-
target-branch: master
209-
commit-message: Distro metadata - Update Ubuntu Unity 25.10 to v${{ env.isotag }}
116+
commit-message: Distro metadata - Update ${{ env.caps }} 25.10 to v${{ env.isotag }}

01_edit_iso.sh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,30 @@
33
set -eu -o pipefail
44
# Prepare the ISO Directories
55
mkdir -p "$ISO_MOUNT_DIR" "$ISO_WORK_DIR" "$CHROOT_DIR"
6+
if [ "$SUBIQUITY" = "yes" ]; then
7+
mkdir -p "$CHROOT_DIR_EXTRA"
8+
fi
9+
610
# Mount the Original ISO and Copy Files
711
echo "mounting $ISO_IMAGE"
812
if [ ! -f "$ISO_IMAGE" ]; then
913
echo "Error: ISO file $ISO_IMAGE not found."
1014
exit 1
1115
fi
16+
1217
mount -o loop "$(pwd)/$ISO_IMAGE" "$ISO_MOUNT_DIR"
13-
rsync -a "$ISO_MOUNT_DIR/" "$ISO_WORK_DIR"
14-
umount "$ISO_MOUNT_DIR"
15-
unsquashfs -d "$CHROOT_DIR" "$ISO_WORK_DIR/casper/filesystem.squashfs"
18+
19+
if [ "$SUBIQUITY" = "yes" ]; then
20+
rsync -a "$ISO_MOUNT_DIR/" "$ISO_WORK_DIR" --include="casper/initrd" --include="casper/vmlinuz" --include="casper/minimal.standard.live.squashfs" --include="casper/minimal.standard.live.manifest" --include="casper/minimal.standard.live.size" --exclude="casper/*" --exclude="md5sum.txt" --exclude="MD5SUMS" --exclude=".disk/release_notes_url" --exclude="casper/*.gpg"
21+
unsquashfs -d "$CHROOT_DIR" "$ISO_MOUNT_DIR/casper/minimal.squashfs"
22+
unsquashfs -d "$CHROOT_DIR_EXTRA" "$ISO_MOUNT_DIR/casper/minimal.standard.squashfs"
23+
rsync -a "$CHROOT_DIR_EXTRA/" "$CHROOT_DIR/"
24+
rm -rf "$CHROOT_DIR_EXTRA"
25+
umount "$ISO_MOUNT_DIR"
26+
else
27+
rsync -a "$ISO_MOUNT_DIR/" "$ISO_WORK_DIR"
28+
umount "$ISO_MOUNT_DIR"
29+
unsquashfs -d "$CHROOT_DIR" "$ISO_WORK_DIR/casper/filesystem.squashfs"
30+
fi
1631

1732
rm "$(pwd)/$ISO_IMAGE"

02_create_iso.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ set -eu -o pipefail
44
echo >&2 "===]> Info: Getting Kernel version ... "
55
echo $T2_KERNEL
66

7-
# Update GRUB Configuration in ISO
8-
echo >&2 "===]> Info: Copying Linux vmlinuz and initrd ... "
9-
cp "$CHROOT_DIR/boot/vmlinuz-$T2_KERNEL" "$ISO_WORK_DIR/casper/vmlinuz"
10-
cp "$CHROOT_DIR/boot/initrd.img-$T2_KERNEL" "$ISO_WORK_DIR/casper/initrd"
7+
if [ "$SUBIQUITY" = "no" ]; then
8+
echo >&2 "===]> Info: Copying Linux vmlinuz and initrd ... "
9+
cp "$CHROOT_DIR/boot/vmlinuz-$T2_KERNEL" "$ISO_WORK_DIR/casper/vmlinuz"
10+
cp "$CHROOT_DIR/boot/initrd.img-$T2_KERNEL" "$ISO_WORK_DIR/casper/initrd"
11+
fi
1112

13+
# Update GRUB Configuration in ISO
1214
echo >&2 "===]> Info: Modify existing grub.cfg ..."
13-
sed -i 's/--- quiet splash/--- quiet splash intel_iommu=on iommu=pt pcie_ports=native/g' "$ISO_WORK_DIR/boot/grub/grub.cfg"
15+
if [ "$SUBIQUITY" = "yes" ]; then
16+
sed -i 's/--- quiet splash/--- quiet splash intel_iommu=on iommu=pt pcie_ports=native/g' "$ISO_WORK_DIR/boot/grub/grub.cfg"
17+
else
18+
sed -i 's/--- quiet splash/boot=casper quiet splash intel_iommu=on iommu=pt pcie_ports=native ---/g' "$ISO_WORK_DIR/boot/grub/grub.cfg"
19+
fi
1420

1521
echo >&2 "===]> Info: Creating EFI image ... "
1622
dd if=/dev/zero of="$ISO_WORK_DIR/EFI/efiboot.img" bs=1M count=10

build.sh

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ROOT_PATH=$(pwd)/work
66
OUTPUT_PATH=$(pwd)/output
77

88
FLAVOUR=$1
9+
FLAVOUR_CAP=$(echo "${FLAVOUR}" | tr '_-' ' ' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2); print}')
910
ISO_MOUNT_DIR="$ROOT_PATH/${FLAVOUR}-original" # Temporary mount point for the original ISO
1011
VER=25.10
1112
CODENAME=questing
@@ -15,6 +16,13 @@ ISO_IMAGE=${FLAVOUR}-25.10-desktop-amd64.iso
1516
ISO_IMAGE_OUTPUT="${OUTPUT_PATH}/${FLAVOUR}-${VER}-${KERNEL_VERSION}-t2-${CODENAME}.iso"
1617
ISO_WORK_DIR="$ROOT_PATH/${FLAVOUR}-iso"
1718
CHROOT_DIR="$ROOT_PATH/${FLAVOUR}-edit"
19+
CHROOT_DIR_EXTRA="$ROOT_PATH/${FLAVOUR}-edit-extra"
20+
21+
if [ "$FLAVOUR" = "ubuntu" ]; then
22+
SUBIQUITY=yes
23+
else
24+
SUBIQUITY=no
25+
fi
1826

1927
echo "ROOT_PATH=$ROOT_PATH"
2028
echo "ISO_MOUNT_DIR=$ISO_MOUNT_DIR"
@@ -34,7 +42,11 @@ apt update && apt update && \
3442
xorriso isolinux grub-efi-amd64-bin mtools dosfstools curl
3543

3644
echo >&2 "===]> Info: Download ISO..."
37-
curl -L -o "$(pwd)/${ISO_IMAGE}" "https://cdimage.ubuntu.com/${FLAVOUR}/releases/${VER}/release/${ISO_IMAGE}"
45+
if [ "$FLAVOUR" = "ubuntu" ]; then
46+
curl -L -o "$(pwd)/${ISO_IMAGE}" "https://releases.ubuntu.com/${VER}/ubuntu-${VER}-desktop-amd64.iso"
47+
else
48+
curl -L -o "$(pwd)/${ISO_IMAGE}" "https://cdimage.ubuntu.com/${FLAVOUR}/releases/${VER}/release/${ISO_IMAGE}"
49+
fi
3850

3951
# Run entrypoint.sh to extract and customize the ISO
4052
echo >&2 "===]> Info: Starting extraction and customization..."
@@ -43,9 +55,11 @@ echo >&2 "===]> Info: Starting extraction and customization..."
4355
ISO_MOUNT_DIR=${ISO_MOUNT_DIR} \\
4456
ISO_WORK_DIR=${ISO_WORK_DIR} \\
4557
CHROOT_DIR=${CHROOT_DIR} \\
58+
CHROOT_DIR_EXTRA=${CHROOT_DIR_EXTRA} \\
4659
ROOT_PATH=${ROOT_PATH} \\
4760
KERNEL_VERSION=${KERNEL_VERSION} \\
4861
FLAVOUR=${FLAVOUR} \\
62+
SUBIQUITY=${SUBIQUITY} \\
4963
$(pwd)/01_edit_iso.sh"
5064

5165
# Enter the Chroot Environment and Apply Customizations
@@ -64,13 +78,14 @@ cp -p /etc/resolv.conf "${CHROOT_DIR}/etc/resolv.conf"
6478
cp "$(pwd)/chroot_iso.sh" "${CHROOT_DIR}/tmp/setup_files"
6579
ls "${CHROOT_DIR}/tmp/setup_files"
6680
echo >&2 "===]> Info: Running chroot environment... "
67-
chroot "${CHROOT_DIR}" /bin/bash -c "KERNEL_VERSION=${KERNEL_VERSION} PKGREL=${PKGREL} /tmp/setup_files/chroot_iso.sh"
81+
chroot "${CHROOT_DIR}" /bin/bash -c "KERNEL_VERSION=${KERNEL_VERSION} PKGREL=${PKGREL} SUBIQUITY=${SUBIQUITY} /tmp/setup_files/chroot_iso.sh"
6882
echo >&2 "===]> Info: Getting Kernel environment... "
6983
T2_KERNEL=${KERNEL_VERSION}-${PKGREL}-t2-${CODENAME}
7084

7185
echo >&2 "===]> Info: Cleanup the chroot environment... "
7286
# restore backup
7387
cp -p "${CHROOT_DIR}/etc/resolv.conf.backup" "${CHROOT_DIR}/etc/resolv.conf"
88+
sleep 10 #Sometimes umount fails as mounts are busy.
7489
umount "${CHROOT_DIR}/dev/pts"
7590
umount "${CHROOT_DIR}/dev"
7691
umount "${CHROOT_DIR}/proc"
@@ -79,8 +94,38 @@ umount "${CHROOT_DIR}/sys"
7994
echo >&2 "===]> Info: Reset firmware flag for fresh boot... "
8095
rm -f "${CHROOT_DIR}/etc/get_apple_firmware_attempted" || true
8196

82-
echo >&2 "===]> Info: Squashing $(echo ${FLAVOUR} | cut -c1 | tr '[a-z]' '[A-Z]')$(echo ${FLAVOUR} | cut -c2-) file system ... "
83-
mksquashfs "$CHROOT_DIR" "$ISO_WORK_DIR/casper/filesystem.squashfs" -comp xz -noappend
97+
echo >&2 "===]> Info: Squashing ${FLAVOUR_CAP} file system ... "
98+
if [ "$SUBIQUITY" = "yes" ]; then
99+
mksquashfs "$CHROOT_DIR" "$ISO_WORK_DIR/casper/minimal.squashfs" -comp xz -noappend
100+
printf "%s" "$(du -sx --block-size=1 "${CHROOT_DIR}" | cut -f1)" >"${ISO_WORK_DIR}"/casper/minimal.size
101+
chroot "${CHROOT_DIR}" dpkg-query -W --showformat='${Package} ${Version}\n' | tee "${ISO_WORK_DIR}"/casper/minimal.manifest
102+
cd ${ISO_WORK_DIR}/casper
103+
ln -s minimal.size minimal.standard.size
104+
ln -s minimal.squashfs minimal.standard.squashfs
105+
ln -s minimal.manifest filesystem.manifest
106+
FILESYSTEM_SIZE=$(($(cat minimal.size)+$(cat minimal.standard.live.size)))
107+
echo ${FILESYSTEM_SIZE} > filesystem.size
108+
cat <<EOF | tee ./install-sources.yaml
109+
kernel:
110+
default: linux-generic-hwe-24.04
111+
sources:
112+
- default: true
113+
description:
114+
en: ${FLAVOUR_CAP} for T2 Macs
115+
id: ${FLAVOUR}-desktop-minimal
116+
locale_support: none
117+
name:
118+
en: ${FLAVOUR_CAP} 25.10 Questing Quokka
119+
path: minimal.squashfs
120+
size: ${FILESYSTEM_SIZE}
121+
type: fsimage-layered
122+
variant: desktop
123+
version: 2
124+
EOF
125+
cd -
126+
else
127+
mksquashfs "$CHROOT_DIR" "$ISO_WORK_DIR/casper/filesystem.squashfs" -comp xz -noappend
128+
fi
84129

85130
# Run create_iso.sh to generate the new ISO
86131
# echo "Creating the custom ISO..."
@@ -92,6 +137,7 @@ echo >&2 "===]> Info: Creating iso ... "
92137
ROOT_PATH=${ROOT_PATH} \\
93138
T2_KERNEL=${T2_KERNEL} \\
94139
FLAVOUR=${FLAVOUR} \\
140+
SUBIQUITY=${SUBIQUITY} \\
95141
$(pwd)/02_create_iso.sh"
96142
# split iso
97143

0 commit comments

Comments
 (0)