From a58339c90926f65cdbe9f1302c7597a0ccfc9073 Mon Sep 17 00:00:00 2001 From: Tomasz Zaworski Date: Wed, 10 Nov 2021 22:01:20 +0100 Subject: [PATCH] Made scripts output more readable. --- buster-amd64/bin/basefs_init | 25 ++++++++++++++++++++----- buster-amd64/bin/dist_iso | 2 +- buster-amd64/bin/helperfs_config | 20 ++++++++++++++------ buster-amd64/bin/rootfs_config | 11 +++++++++-- buster-amd64/mkrescue | 27 +++++++++++++++++++++++++-- 5 files changed, 69 insertions(+), 16 deletions(-) diff --git a/buster-amd64/bin/basefs_init b/buster-amd64/bin/basefs_init index 4eecc5e..29bf778 100755 --- a/buster-amd64/bin/basefs_init +++ b/buster-amd64/bin/basefs_init @@ -4,9 +4,16 @@ TARGET=$1 DEBIAN_CODENAME=$2 LANG=C +APT_PARAM='' +STDOUT='/dev/stdout' +if [ !$MKRESCUE_VERBOSE ]; then + APT_PARAM='-qq -o=Dpkg::Use-Pty=0'; + STDOUT='/dev/null'; +fi + mkdir ${TARGET} -debootstrap --arch=amd64 --variant=minbase ${DEBIAN_CODENAME} ${TARGET} http://httpredir.debian.org/debian +debootstrap --arch=amd64 --variant=minbase ${DEBIAN_CODENAME} ${TARGET} http://httpredir.debian.org/debian > $STDOUT cat << EOF > ${TARGET}/etc/apt/sources.list deb http://httpredir.debian.org/debian ${DEBIAN_CODENAME} main contrib non-free @@ -19,11 +26,19 @@ APT::Install-Recommends '0'; APT::Install-Suggests '0'; EOF +cat << EOF > ${TARGET}/etc/apt/preferences.d/backports +Package: * +Pin: release n=buster-backports +Pin-Priority: 500 +EOF + echo wmirescue > ${TARGET}/etc/hostname echo 'root:wmi' | chroot ${TARGET} chpasswd -chroot ${TARGET} apt-get update -chroot ${TARGET} apt-get upgrade --yes -chroot ${TARGET} apt-get clean - +chroot ${TARGET} mount -t devpts devpts /dev/pts +chroot ${TARGET} apt-get $APT_PARAM update > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM --yes install apt-utils > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM upgrade --yes > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM clean > $STDOUT +chroot ${TARGET} umount /dev/pts diff --git a/buster-amd64/bin/dist_iso b/buster-amd64/bin/dist_iso index 8da1723..7238133 100755 --- a/buster-amd64/bin/dist_iso +++ b/buster-amd64/bin/dist_iso @@ -73,7 +73,7 @@ for module in normal boot extcmd crypto terminal gettext bufio \ linux video relocator mmap vbe video_fb \ linux16 \ gfxterm font gfxmenu trig bitmap_scale bitmap video_colors \ - png; do + png verifiers; do cp /usr/lib/grub/i386-pc/${module}.mod $TEMP_DIR/boot/bios/i386-pc done; diff --git a/buster-amd64/bin/helperfs_config b/buster-amd64/bin/helperfs_config index b1b2b88..000c61c 100755 --- a/buster-amd64/bin/helperfs_config +++ b/buster-amd64/bin/helperfs_config @@ -5,6 +5,14 @@ KERNEL_VERSION=$2 KERNEL_REPO=$3 LANG=C +APT_PARAM='' +STDOUT='/dev/stdout' +if [ !$MKRESCUE_VERBOSE ]; then + APT_PARAM='-qq -o=Dpkg::Use-Pty=0'; + STDOUT='/dev/null'; +fi + + FIRMWARES1="firmware-linux-free" FIRMWARES2="firmware-bnx2 firmware-bnx2x firmware-cavium \ firmware-misc-nonfree firmware-myricom firmware-netxen firmware-qlogic \ @@ -12,15 +20,15 @@ FIRMWARES2="firmware-bnx2 firmware-bnx2x firmware-cavium \ cat << EOF > $TARGET/usr/sbin/policy-rc.d #!/bin/sh -echo "All runlevel operations denied by policy" >&2 +#echo "All runlevel operations denied by policy" >&2 exit 101 EOF chmod a+x $TARGET/usr/sbin/policy-rc.d chroot ${TARGET} mount -t proc proc /proc -chroot ${TARGET} apt-get --yes install busybox-static -chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} linux-image-${KERNEL_VERSION} linux-headers-${KERNEL_VERSION} -chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} zfs-dkms -chroot ${TARGET} apt-get --yes install ${FIRMWARES1} -chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} ${FIRMWARES2} +chroot ${TARGET} apt-get $APT_PARAM --yes install busybox-static > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} linux-image-${KERNEL_VERSION} linux-headers-${KERNEL_VERSION} > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} zfs-dkms > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM --yes install ${FIRMWARES1} > $STDOUT +chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} ${FIRMWARES2} > $STDOUT chroot ${TARGET} umount /proc diff --git a/buster-amd64/bin/rootfs_config b/buster-amd64/bin/rootfs_config index 8aadbc6..64916cb 100755 --- a/buster-amd64/bin/rootfs_config +++ b/buster-amd64/bin/rootfs_config @@ -5,6 +5,13 @@ DEBIAN_CODENAME=$2 LANG=C VERSION="$(date +%g.%m)" +APT_PARAM='' +STDOUT='/dev/stdout' +if [ !$MKRESCUE_VERBOSE ]; then + APT_PARAM='-qq -o=Dpkg::Use-Pty=0'; + STDOUT='/dev/null' +fi + SOFTWARE="acl acpi-support-base attr bash-completion bind9-host binutils \ bridge-utils bsdmainutils ca-certificates debootstrap dialog \ dmidecode dosfstools ethtool file gddrescue gdisk \ @@ -17,13 +24,13 @@ SOFTWARE="acl acpi-support-base attr bash-completion bind9-host binutils \ cat << EOF > ${TARGET}/usr/sbin/policy-rc.d #!/bin/sh -echo "All runlevel operations denied by policy" >&2 +#echo "All runlevel operations denied by policy" >&2 exit 101 EOF chmod a+x $TARGET/usr/sbin/policy-rc.d export DEBIAN_FRONTEND=noninteractive -chroot ${TARGET} apt-get --yes install ${SOFTWARE} +chroot ${TARGET} apt-get $APT_PARAM --yes install ${SOFTWARE} > $STDOUT chroot ${TARGET} systemctl enable systemd-networkd.service chroot ${TARGET} systemctl enable systemd-resolved.service chroot ${TARGET} systemctl enable acpid.service diff --git a/buster-amd64/mkrescue b/buster-amd64/mkrescue index 52dc391..a445e59 100755 --- a/buster-amd64/mkrescue +++ b/buster-amd64/mkrescue @@ -4,10 +4,17 @@ TARGET=$1 VERSION=$(date +%g.%m) OUTPUT=${TARGET}/output/${VERSION} DEBIAN_CODENAME='buster' -KERNEL_VERSION='5.10.0-0.bpo.3-amd64' +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 @@ -17,40 +24,52 @@ 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/lib/modules +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 @@ -60,7 +79,11 @@ cp ${TARGET}/helperfs/boot/vmlinuz-${KERNEL_VERSION} ${OUTPUT}/netboot/${ARCH}/v # 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