T2-Ubuntu/build.sh

94 lines
2.6 KiB
Bash
Raw Normal View History

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"
2022-02-03 16:16:56 +03:00
KERNEL_VERSION=5.16.5
PKGREL=2
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... "
2021-12-25 06:40:46 +03:00
for ALTERNATIVE in t2
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
2020-07-20 14:45:11 +03:00
echo >&2 "===]> Info: Build Ubuntu FS... "
/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} \\
${ROOT_PATH}/01_build_file_system.sh
"
2020-04-24 13:19:37 +03:00
2020-07-20 14:45:11 +03:00
echo >&2 "===]> Info: Build Image FS... "
/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} \\
${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} \\
${ROOT_PATH}/04_create_iso.sh
"
livecd_exitcode=$?
if [ "${livecd_exitcode}" -ne 0 ]; then
echo "Error building ${KERNEL_VERSION}-${ALTERNATIVE}"
exit "${livecd_exitcode}"
fi
### Zip iso and split it into multiple parts - github max size of release attachment is 2GB, where ISO is sometimes bigger than that
cd "${ROOT_PATH}"
2021-11-22 11:19:38 +03:00
zip -s 1500m "${ROOT_PATH}/output/livecd-${KERNEL_VERSION}-${ALTERNATIVE}.zip" "${ROOT_PATH}/ubuntu-20.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}"