90 lines
3.0 KiB
Bash
Executable File
90 lines
3.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.9-amd64'
|
|
KERNEL_REPO="buster-backports"
|
|
ARCH='amd64'
|
|
|
|
QUIET=1
|
|
export MKRESCUE_VERBOSE=1
|
|
|
|
export LANGUAGE=C
|
|
export LANG=C
|
|
export LC_ALL=C
|
|
|
|
umask 022
|
|
|
|
if [ -z "${TARGET}" ]; then
|
|
echo "Usage: $0 <work_dir>"
|
|
exit 255
|
|
fi
|
|
|
|
SCRIPTDIR="$(dirname "$(realpath "$0")")"
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
mkdir ${TARGET}
|
|
mkdir ${TARGET}/ramdisk
|
|
mkdir ${TARGET}/firmware
|
|
mkdir -p ${OUTPUT}/netboot/${ARCH}
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing basefs_init ###'; fi
|
|
${SCRIPTDIR}/bin/basefs_init ${TARGET}/basefs ${DEBIAN_CODENAME}
|
|
|
|
cp -a ${TARGET}/basefs ${TARGET}/rootfs
|
|
cp -a ${TARGET}/basefs ${TARGET}/helperfs
|
|
|
|
if [ !$QUIET ]; then echo '\n### Executing helperfs_config ###'; fi
|
|
${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/
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_config ###'; fi
|
|
${SCRIPTDIR}/bin/rootfs_config ${TARGET}/rootfs ${DEBIAN_CODENAME}
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_clear ###'; fi
|
|
${SCRIPTDIR}/bin/rootfs_clear ${TARGET}/rootfs
|
|
if [ !$QUIET ]; then echo '\n### Executing rootfs_mksquashfs ###'; fi
|
|
${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/usr/lib/modules
|
|
ln -s usr/lib ${TARGET}/ramdisk/lib
|
|
mkdir -p ${TARGET}/ramdisk/proc
|
|
mkdir -p ${TARGET}/ramdisk/sys
|
|
cp ${TARGET}/helperfs/bin/busybox ${TARGET}/ramdisk/bin/busybox
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_modules ###'; fi
|
|
${SCRIPTDIR}/bin/ramdisk_modules ${TARGET}/ramdisk ${TARGET}/rootfs ${KERNEL_VERSION}
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_config ###'; fi
|
|
${SCRIPTDIR}/bin/ramdisk_config ${TARGET}/ramdisk ${KERNEL_VERSION}
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_make ###'; fi
|
|
${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
|
|
if [ !$QUIET ]; then echo '\n### Executing ramdisk_make ###'; fi
|
|
${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 .
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe ###'; fi
|
|
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT}
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe --nofirmware ###'; fi
|
|
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_iso ###'; fi
|
|
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT}
|
|
if [ !$QUIET ]; then echo '\n### Executing dist_iso --nofirmware ###'; fi
|
|
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} --nofirmware
|