2020-04-17 12:53:48 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2020-05-06 22:25:05 +03:00
|
|
|
ROOT_PATH=$(pwd)
|
|
|
|
WORKING_PATH=/root/work
|
|
|
|
CHROOT_PATH="${WORKING_PATH}/chroot"
|
|
|
|
IMAGE_PATH="${WORKING_PATH}/image"
|
2023-05-01 20:23:45 +03:00
|
|
|
KERNEL_VERSION=6.3.1
|
2023-03-06 16:28:05 +03:00
|
|
|
PKGREL=1
|
2022-01-15 08:13:47 +03:00
|
|
|
sed -i "s/KVER/${KERNEL_VERSION}/g" $(pwd)/files/chroot_build.sh
|
|
|
|
sed -i "s/PREL/${PKGREL}/g" $(pwd)/files/chroot_build.sh
|
2020-04-17 12:53:48 +03:00
|
|
|
|
2020-04-17 19:31:32 +03:00
|
|
|
if [ -d "$WORKING_PATH" ]; then
|
2020-04-24 13:19:37 +03:00
|
|
|
rm -rf "$WORKING_PATH"
|
2020-04-17 19:31:32 +03:00
|
|
|
fi
|
|
|
|
mkdir -p "$WORKING_PATH"
|
2020-07-20 14:45:11 +03:00
|
|
|
if [ -d "${ROOT_PATH}/output" ]; then
|
|
|
|
rm -rf "${ROOT_PATH}/output"
|
|
|
|
fi
|
|
|
|
mkdir -p "${ROOT_PATH}/output"
|
2020-04-17 19:31:32 +03:00
|
|
|
|
2020-04-24 13:19:37 +03:00
|
|
|
echo >&2 "===]> Info: Build dependencies... "
|
2020-04-17 12:53:48 +03:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-04-17 19:31:32 +03:00
|
|
|
apt-get update
|
2020-04-17 12:53:48 +03:00
|
|
|
apt-get install -y -qq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
|
2020-04-24 13:19:37 +03:00
|
|
|
binutils \
|
|
|
|
debootstrap \
|
|
|
|
squashfs-tools \
|
|
|
|
xorriso \
|
|
|
|
grub-pc-bin \
|
|
|
|
grub-efi-amd64-bin \
|
|
|
|
mtools \
|
|
|
|
dosfstools \
|
|
|
|
zip \
|
|
|
|
isolinux \
|
2020-05-03 16:04:34 +03:00
|
|
|
syslinux
|
2020-04-24 13:19:37 +03:00
|
|
|
|
2020-07-20 14:45:11 +03:00
|
|
|
echo >&2 "===]> Info: Start loop... "
|
2022-12-20 12:27:08 +03:00
|
|
|
for ALTERNATIVE in t2-jammy
|
2021-11-22 09:45:13 +03:00
|
|
|
do
|
2020-07-20 14:45:11 +03:00
|
|
|
echo >&2 "===]> Info: Start building ${ALTERNATIVE}... "
|
2020-04-24 13:19:37 +03:00
|
|
|
|
2022-05-20 14:52:30 +03:00
|
|
|
echo >&2 "===]> Info: Build Ubuntu Jammy... "
|
2020-07-20 14:45:11 +03:00
|
|
|
/bin/bash -c "
|
|
|
|
ROOT_PATH=${ROOT_PATH} \\
|
|
|
|
WORKING_PATH=${WORKING_PATH} \\
|
|
|
|
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
|
|
|
|
IMAGE_PATH=${IMAGE_PATH} \\
|
|
|
|
KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\
|
2022-10-17 19:40:55 +03:00
|
|
|
ALTERNATIVE=${ALTERNATIVE} \\
|
2020-07-20 14:45:11 +03:00
|
|
|
${ROOT_PATH}/01_build_file_system.sh
|
|
|
|
"
|
2020-04-24 13:19:37 +03:00
|
|
|
|
2022-05-20 14:52:30 +03:00
|
|
|
echo >&2 "===]> Info: Build Image Jammy... "
|
2020-07-20 14:45:11 +03:00
|
|
|
/bin/bash -c "
|
|
|
|
ROOT_PATH=${ROOT_PATH} \\
|
|
|
|
WORKING_PATH=${WORKING_PATH} \\
|
|
|
|
CHROOT_PATH=${CHROOT_PATH}_${ALTERNATIVE} \\
|
|
|
|
IMAGE_PATH=${IMAGE_PATH} \\
|
|
|
|
KERNEL_VERSION=${KERNEL_VERSION}-${ALTERNATIVE} \\
|
2022-10-17 19:40:55 +03:00
|
|
|
ALTERNATIVE=${ALTERNATIVE} \\
|
2020-07-20 14:45:11 +03:00
|
|
|
${ROOT_PATH}/02_build_image.sh
|
|
|
|
"
|
2020-04-17 12:53:48 +03:00
|
|
|
|
2020-07-20 14:45:11 +03:00
|
|
|
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
|
|
|
|
"
|
2020-04-17 12:53:48 +03:00
|
|
|
|
2020-07-20 14:45:11 +03:00
|
|
|
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} \\
|
2022-10-17 19:40:55 +03:00
|
|
|
ALTERNATIVE=${ALTERNATIVE} \\
|
2020-07-20 14:45:11 +03:00
|
|
|
${ROOT_PATH}/04_create_iso.sh
|
|
|
|
"
|
|
|
|
livecd_exitcode=$?
|
|
|
|
if [ "${livecd_exitcode}" -ne 0 ]; then
|
|
|
|
echo "Error building ${KERNEL_VERSION}-${ALTERNATIVE}"
|
|
|
|
exit "${livecd_exitcode}"
|
|
|
|
fi
|
2023-01-18 13:08:18 +03:00
|
|
|
## Zip iso and split it into multiple parts - github max size of release attachment is 2GB, where ISO is sometimes bigger than that
|
2020-07-20 14:45:11 +03:00
|
|
|
cd "${ROOT_PATH}"
|
2022-10-01 22:40:43 +03:00
|
|
|
zip -s 1500m "${ROOT_PATH}/output/livecd-${KERNEL_VERSION}-${ALTERNATIVE}.zip" "${ROOT_PATH}/ubuntu-22.04-${KERNEL_VERSION}-${ALTERNATIVE}.iso"
|
2020-07-20 14:45:11 +03:00
|
|
|
done
|
2021-11-20 12:40:53 +03:00
|
|
|
## Calculate sha256 sums of built ISO
|
2020-04-24 13:19:37 +03:00
|
|
|
sha256sum "${ROOT_PATH}"/*.iso >"${ROOT_PATH}/output/sha256"
|
2020-04-17 12:53:48 +03:00
|
|
|
|
|
|
|
find ./ | grep ".iso"
|
|
|
|
find ./ | grep ".zip"
|
|
|
|
|
2020-07-20 14:45:11 +03:00
|
|
|
exit "${livecd_exitcode}"
|