wmirescue/buster-amd64/mkrescue

67 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
TARGET=$1
VERSION=$(date +%g.%m)
OUTPUT=${TARGET}/output/${VERSION}
DEBIAN_CODENAME='buster'
KERNEL_VERSION='5.10.0-0.bpo.3-amd64'
KERNEL_REPO="buster-backports"
ARCH='amd64'
umask 022
if [ -z "${TARGET}" ]; then
echo "Usage: $0 <work_dir>"
exit 255
fi
SCRIPTDIR="$(dirname "$(realpath "$0")")"
mkdir ${TARGET}
mkdir ${TARGET}/ramdisk
mkdir ${TARGET}/firmware
mkdir -p ${OUTPUT}/netboot/${ARCH}
${SCRIPTDIR}/bin/basefs_init ${TARGET}/basefs ${DEBIAN_CODENAME}
cp -a ${TARGET}/basefs ${TARGET}/rootfs
cp -a ${TARGET}/basefs ${TARGET}/helperfs
${SCRIPTDIR}/bin/helperfs_config ${TARGET}/helperfs ${KERNEL_VERSION} ${KERNEL_REPO}
# ROOTFS
mkdir -p ${TARGET}/rootfs/lib/modules
rsync -aS ${TARGET}/helperfs/lib/modules/ ${TARGET}/rootfs/lib/modules/
${SCRIPTDIR}/bin/rootfs_config ${TARGET}/rootfs ${DEBIAN_CODENAME}
${SCRIPTDIR}/bin/rootfs_clear ${TARGET}/rootfs
${SCRIPTDIR}/bin/rootfs_mksquashfs ${TARGET}/rootfs ${TARGET}/ramdisk/rootfs.squash
# RAMDISK
mkdir -p ${TARGET}/ramdisk/bin
mkdir -p ${TARGET}/ramdisk/dev
mkdir -p ${TARGET}/ramdisk/lib/modules
mkdir -p ${TARGET}/ramdisk/proc
mkdir -p ${TARGET}/ramdisk/sys
cp ${TARGET}/helperfs/bin/busybox ${TARGET}/ramdisk/bin/busybox
${SCRIPTDIR}/bin/ramdisk_modules ${TARGET}/ramdisk ${TARGET}/rootfs ${KERNEL_VERSION}
${SCRIPTDIR}/bin/ramdisk_config ${TARGET}/ramdisk ${KERNEL_VERSION}
${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/${ARCH}/initrd.img ${TARGET}/ramdisk
# FIRMWARE
tar cf ${TARGET}/firmware/firmware.tar --owner=root --group=root -C ${TARGET}/helperfs ./lib/firmware
${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/firmware.img ${TARGET}/firmware
# KERNEL
cp ${TARGET}/helperfs/boot/vmlinuz-${KERNEL_VERSION} ${OUTPUT}/netboot/${ARCH}/vmlinuz
# DIST
tar cvf ${OUTPUT}/wmirescue_${ARCH}-netboot.tar -C ${OUTPUT}/netboot .
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT}
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT}
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} --nofirmware