wmirescue/buster-amd64/mkrescue

90 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/sh
TARGET=$1
VERSION=$(date +%g.%m)
OUTPUT=${TARGET}/output/${VERSION}
DEBIAN_CODENAME='buster'
2021-11-10 22:01:20 +01:00
KERNEL_VERSION='5.10.0-0.bpo.9-amd64'
2021-07-29 12:42:53 +02:00
KERNEL_REPO="buster-backports"
ARCH='amd64'
2021-11-10 22:01:20 +01:00
QUIET=1
export MKRESCUE_VERBOSE=1
export LANGUAGE=C
export LANG=C
export LC_ALL=C
2019-08-08 18:07:28 +02:00
umask 022
if [ -z "${TARGET}" ]; then
echo "Usage: $0 <work_dir>"
exit 255
fi
SCRIPTDIR="$(dirname "$(realpath "$0")")"
2021-11-10 22:01:20 +01:00
export DEBIAN_FRONTEND=noninteractive
mkdir ${TARGET}
mkdir ${TARGET}/ramdisk
mkdir ${TARGET}/firmware
mkdir -p ${OUTPUT}/netboot/${ARCH}
2021-11-10 22:01:20 +01:00
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
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing helperfs_config ###'; fi
2021-07-29 12:42:53 +02:00
${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/
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing rootfs_config ###'; fi
${SCRIPTDIR}/bin/rootfs_config ${TARGET}/rootfs ${DEBIAN_CODENAME}
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing rootfs_clear ###'; fi
${SCRIPTDIR}/bin/rootfs_clear ${TARGET}/rootfs
2021-11-10 22:01:20 +01:00
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
2021-11-10 22:01:20 +01:00
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
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing ramdisk_modules ###'; fi
${SCRIPTDIR}/bin/ramdisk_modules ${TARGET}/ramdisk ${TARGET}/rootfs ${KERNEL_VERSION}
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing ramdisk_config ###'; fi
${SCRIPTDIR}/bin/ramdisk_config ${TARGET}/ramdisk ${KERNEL_VERSION}
2021-11-10 22:01:20 +01:00
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
2021-11-10 22:01:20 +01:00
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 .
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe ###'; fi
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT}
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe --nofirmware ###'; fi
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing dist_iso ###'; fi
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT}
2021-11-10 22:01:20 +01:00
if [ !$QUIET ]; then echo '\n### Executing dist_iso --nofirmware ###'; fi
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} --nofirmware