r11_isocreate/build
2024-06-07 23:03:10 +03:00

90 lines
2.1 KiB
Bash
Executable file

#!/bin/bash
set -x #verbose output
#set -e #fail in case of any error (currently this code is not ready for this)
. common-funcs.sh || exit 1
losetup -a
losetup -D
# Default set of images: 64-bit with UEFI and 32-bit without UEFI
TYPES="${TYPES:-64u 32 32u}"
[ -z "$DE" ] && DE="NO_DE"
DE_BIG="$(echo ${DE} | tr '[:lower:]' '[:upper:]' )"
product_id="ROSA.FRESH.${DE_BIG}.${RELEASE}"
DIRNAME="$(dirname $0)"
cd "$DIRNAME"
build_root="./"
ks="${build_root}/.ks"
# build different architectures
num_good=0
num_fail=0
# Possible ISO types: 32- or 64-bit with or without UEFI (32, 32u, 64, 64u)
for type in $TYPES; do
set_types
uefi="${uefi,,}"
echo ""
echo "!!! BUILDING ISO $arch$uefi !!!"
echo ""
# Prepare package lists (common and architecture-dependent)
cp -f common$DE.lst common$arch.lst
cp -f $arch$DE.lst $arch.lst
if [ "$uefi" = "u" ]; then
# Append UEFI-related packages
cat uefi.lst >> common$arch.lst
fi
# Replace lib prefix according to the architecture
sed -i -e 's/${lib}/'$lib'/g' common$arch.lst
sed -i -e 's/${lib}/'$lib'/g' $arch.lst
# Prepare the kickstart file
cp -f ${ks}.template ${ks}
sed -i -e "s:#ARCH#:$arch:g" ${ks}
sed -i -e "s:#PATH#:${build_root}/:g" ${ks}
sed -i -e "s:#BUILD_ID#:${BUILD_ID}:g" ${ks}
mkdir -p $build_root/iso/${product_id}/
if livecd-creator --config=${ks} --fslabel=${product_id}.$arch --title="ROSA Desktop Fresh $RELEASE" --skip-minimize; then
num_good=$((num_good + 1))
mv ${product_id}.$arch.iso $build_root/iso/${product_id}/
pushd $build_root/iso/${product_id}/
if [ "$uefi" = "u" ]; then
uefi_s=".uefi"
else
uefi_s=""
fi
md5sum ${product_id}.$arch.iso > ${product_id}.$arch$uefi_s.iso.md5sum
ISONAME="${product_id}.$BUILD_ID.b.$arch$uefi_s.iso"
mv ${product_id}.$arch.iso $ISONAME
popd
echo ""
echo " ALL DONE! $build_root/iso/${product_id}/$ISONAME"
echo ""
else
num_fail=$((num_fail + 1))
echo ""
echo " FAILURE!"
echo ""
fi
done
if [ "$num_good" = 0 ]; then
# All archs failed
exit 1
elif [ "$num_fail" = 0 ]; then
# All archs succeeded
exit 0
else
# Some failed, some OK - using special error code 6
exit 6
fi