-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
build.sh
executable file
·96 lines (86 loc) · 2.75 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -eu -o pipefail
ROOT_PATH=$(pwd)
WORKING_PATH=/root/work
CHROOT_PATH="${WORKING_PATH}/chroot"
IMAGE_PATH="${WORKING_PATH}/image"
KERNEL_VERSION=6.12.4
PKGREL=1
sed -i "s/KVER/${KERNEL_VERSION}/g" $(pwd)/files/chroot_build.sh
sed -i "s/PREL/${PKGREL}/g" $(pwd)/files/chroot_build.sh
if [ -d "$WORKING_PATH" ]; then
rm -rf "$WORKING_PATH"
fi
mkdir -p "$WORKING_PATH"
if [ -d "${ROOT_PATH}/output" ]; then
rm -rf "${ROOT_PATH}/output"
fi
mkdir -p "${ROOT_PATH}/output"
echo >&2 "===]> Info: Build dependencies... "
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
binutils \
debootstrap \
squashfs-tools \
xorriso \
grub-pc-bin \
grub-efi-amd64-bin \
mtools \
dosfstools \
zip \
isolinux \
syslinux
echo >&2 "===]> Info: Start loop... "
for ALTERNATIVE in t2-noble
do
echo >&2 "===]> Info: Start building ${ALTERNATIVE}... "
echo >&2 "===]> Info: Build Ubuntu Noble... "
/bin/bash -c "
ROOT_PATH=${ROOT_PATH} \\
WORKING_PATH=${WORKING_PATH} \\
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
IMAGE_PATH=${IMAGE_PATH} \\
KERNEL_VERSION=${KERNEL_VERSION}-${PKGREL}-${ALTERNATIVE} \\
ALTERNATIVE=${ALTERNATIVE} \\
${ROOT_PATH}/01_build_file_system.sh
"
echo >&2 "===]> Info: Build Image Noble... "
/bin/bash -c "
ROOT_PATH=${ROOT_PATH} \\
WORKING_PATH=${WORKING_PATH} \\
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
IMAGE_PATH=${IMAGE_PATH} \\
KERNEL_VERSION=${KERNEL_VERSION}-${PKGREL}-${ALTERNATIVE} \\
ALTERNATIVE=${ALTERNATIVE} \\
${ROOT_PATH}/02_build_image.sh
"
echo >&2 "===]> Info: Prepare Boot for ISO... "
/bin/bash -c "
IMAGE_PATH=${IMAGE_PATH} \\
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
${ROOT_PATH}/03_prepare_iso.sh
"
echo >&2 "===]> Info: Create ISO... "
/bin/bash -c "
ROOT_PATH=${ROOT_PATH} \\
IMAGE_PATH=${IMAGE_PATH} \\
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\
ALTERNATIVE=${ALTERNATIVE} \\
${ROOT_PATH}/04_create_iso.sh
"
livecd_exitcode=$?
if [ "${livecd_exitcode}" -ne 0 ]; then
echo "Error building ${KERNEL_VERSION}-${ALTERNATIVE}"
exit "${livecd_exitcode}"
fi
## Split iso into multiple parts - github max size of release attachment is 2GB, where ISO is sometimes bigger than that
cd "${ROOT_PATH}"
split -b 900M -x "${ROOT_PATH}/ubuntu-24.04-${KERNEL_VERSION}-${ALTERNATIVE}.iso" "${ROOT_PATH}/output/ubuntu-24.04-${KERNEL_VERSION}-${ALTERNATIVE}.iso."
done
## Calculate sha256 sums of built ISO
sha256sum "${ROOT_PATH}"/*.iso >"${ROOT_PATH}/output/sha256-ubuntu-24.04"
find ./ | grep ".iso"
#find ./ | grep ".zip"
exit "${livecd_exitcode}"