Made scripts output more readable.

This commit is contained in:
Tomasz Zaworski 2021-11-10 22:01:20 +01:00
parent 4ab2db3683
commit a58339c909
5 changed files with 69 additions and 16 deletions

View File

@ -4,9 +4,16 @@ TARGET=$1
DEBIAN_CODENAME=$2 DEBIAN_CODENAME=$2
LANG=C 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} 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 cat << EOF > ${TARGET}/etc/apt/sources.list
deb http://httpredir.debian.org/debian ${DEBIAN_CODENAME} main contrib non-free deb http://httpredir.debian.org/debian ${DEBIAN_CODENAME} main contrib non-free
@ -19,11 +26,19 @@ APT::Install-Recommends '0';
APT::Install-Suggests '0'; APT::Install-Suggests '0';
EOF 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 wmirescue > ${TARGET}/etc/hostname
echo 'root:wmi' | chroot ${TARGET} chpasswd echo 'root:wmi' | chroot ${TARGET} chpasswd
chroot ${TARGET} apt-get update chroot ${TARGET} mount -t devpts devpts /dev/pts
chroot ${TARGET} apt-get upgrade --yes chroot ${TARGET} apt-get $APT_PARAM update > $STDOUT
chroot ${TARGET} apt-get clean 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

View File

@ -73,7 +73,7 @@ for module in normal boot extcmd crypto terminal gettext bufio \
linux video relocator mmap vbe video_fb \ linux video relocator mmap vbe video_fb \
linux16 \ linux16 \
gfxterm font gfxmenu trig bitmap_scale bitmap video_colors \ 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 cp /usr/lib/grub/i386-pc/${module}.mod $TEMP_DIR/boot/bios/i386-pc
done; done;

View File

@ -5,6 +5,14 @@ KERNEL_VERSION=$2
KERNEL_REPO=$3 KERNEL_REPO=$3
LANG=C 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" FIRMWARES1="firmware-linux-free"
FIRMWARES2="firmware-bnx2 firmware-bnx2x firmware-cavium \ FIRMWARES2="firmware-bnx2 firmware-bnx2x firmware-cavium \
firmware-misc-nonfree firmware-myricom firmware-netxen firmware-qlogic \ 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 cat << EOF > $TARGET/usr/sbin/policy-rc.d
#!/bin/sh #!/bin/sh
echo "All runlevel operations denied by policy" >&2 #echo "All runlevel operations denied by policy" >&2
exit 101 exit 101
EOF EOF
chmod a+x $TARGET/usr/sbin/policy-rc.d chmod a+x $TARGET/usr/sbin/policy-rc.d
chroot ${TARGET} mount -t proc proc /proc chroot ${TARGET} mount -t proc proc /proc
chroot ${TARGET} apt-get --yes install busybox-static chroot ${TARGET} apt-get $APT_PARAM --yes install busybox-static > $STDOUT
chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} linux-image-${KERNEL_VERSION} linux-headers-${KERNEL_VERSION} chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} linux-image-${KERNEL_VERSION} linux-headers-${KERNEL_VERSION} > $STDOUT
chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} zfs-dkms chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} zfs-dkms > $STDOUT
chroot ${TARGET} apt-get --yes install ${FIRMWARES1} chroot ${TARGET} apt-get $APT_PARAM --yes install ${FIRMWARES1} > $STDOUT
chroot ${TARGET} apt-get --yes install -t ${KERNEL_REPO} ${FIRMWARES2} chroot ${TARGET} apt-get $APT_PARAM --yes install -t ${KERNEL_REPO} ${FIRMWARES2} > $STDOUT
chroot ${TARGET} umount /proc chroot ${TARGET} umount /proc

View File

@ -5,6 +5,13 @@ DEBIAN_CODENAME=$2
LANG=C LANG=C
VERSION="$(date +%g.%m)" 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 \ SOFTWARE="acl acpi-support-base attr bash-completion bind9-host binutils \
bridge-utils bsdmainutils ca-certificates debootstrap dialog \ bridge-utils bsdmainutils ca-certificates debootstrap dialog \
dmidecode dosfstools ethtool file gddrescue gdisk \ 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 cat << EOF > ${TARGET}/usr/sbin/policy-rc.d
#!/bin/sh #!/bin/sh
echo "All runlevel operations denied by policy" >&2 #echo "All runlevel operations denied by policy" >&2
exit 101 exit 101
EOF EOF
chmod a+x $TARGET/usr/sbin/policy-rc.d chmod a+x $TARGET/usr/sbin/policy-rc.d
export DEBIAN_FRONTEND=noninteractive 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-networkd.service
chroot ${TARGET} systemctl enable systemd-resolved.service chroot ${TARGET} systemctl enable systemd-resolved.service
chroot ${TARGET} systemctl enable acpid.service chroot ${TARGET} systemctl enable acpid.service

View File

@ -4,10 +4,17 @@ TARGET=$1
VERSION=$(date +%g.%m) VERSION=$(date +%g.%m)
OUTPUT=${TARGET}/output/${VERSION} OUTPUT=${TARGET}/output/${VERSION}
DEBIAN_CODENAME='buster' 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" KERNEL_REPO="buster-backports"
ARCH='amd64' ARCH='amd64'
QUIET=1
export MKRESCUE_VERBOSE=1
export LANGUAGE=C
export LANG=C
export LC_ALL=C
umask 022 umask 022
if [ -z "${TARGET}" ]; then if [ -z "${TARGET}" ]; then
@ -17,40 +24,52 @@ fi
SCRIPTDIR="$(dirname "$(realpath "$0")")" SCRIPTDIR="$(dirname "$(realpath "$0")")"
export DEBIAN_FRONTEND=noninteractive
mkdir ${TARGET} mkdir ${TARGET}
mkdir ${TARGET}/ramdisk mkdir ${TARGET}/ramdisk
mkdir ${TARGET}/firmware mkdir ${TARGET}/firmware
mkdir -p ${OUTPUT}/netboot/${ARCH} mkdir -p ${OUTPUT}/netboot/${ARCH}
if [ !$QUIET ]; then echo '\n### Executing basefs_init ###'; fi
${SCRIPTDIR}/bin/basefs_init ${TARGET}/basefs ${DEBIAN_CODENAME} ${SCRIPTDIR}/bin/basefs_init ${TARGET}/basefs ${DEBIAN_CODENAME}
cp -a ${TARGET}/basefs ${TARGET}/rootfs cp -a ${TARGET}/basefs ${TARGET}/rootfs
cp -a ${TARGET}/basefs ${TARGET}/helperfs 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} ${SCRIPTDIR}/bin/helperfs_config ${TARGET}/helperfs ${KERNEL_VERSION} ${KERNEL_REPO}
# ROOTFS # ROOTFS
mkdir -p ${TARGET}/rootfs/lib/modules mkdir -p ${TARGET}/rootfs/lib/modules
rsync -aS ${TARGET}/helperfs/lib/modules/ ${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} ${SCRIPTDIR}/bin/rootfs_config ${TARGET}/rootfs ${DEBIAN_CODENAME}
if [ !$QUIET ]; then echo '\n### Executing rootfs_clear ###'; fi
${SCRIPTDIR}/bin/rootfs_clear ${TARGET}/rootfs ${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 ${SCRIPTDIR}/bin/rootfs_mksquashfs ${TARGET}/rootfs ${TARGET}/ramdisk/rootfs.squash
# RAMDISK # RAMDISK
mkdir -p ${TARGET}/ramdisk/bin mkdir -p ${TARGET}/ramdisk/bin
mkdir -p ${TARGET}/ramdisk/dev 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/proc
mkdir -p ${TARGET}/ramdisk/sys mkdir -p ${TARGET}/ramdisk/sys
cp ${TARGET}/helperfs/bin/busybox ${TARGET}/ramdisk/bin/busybox 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} ${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} ${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 ${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/${ARCH}/initrd.img ${TARGET}/ramdisk
# FIRMWARE # FIRMWARE
tar cf ${TARGET}/firmware/firmware.tar --owner=root --group=root -C ${TARGET}/helperfs ./lib/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 ${SCRIPTDIR}/bin/ramdisk_make ${OUTPUT}/netboot/firmware.img ${TARGET}/firmware
# KERNEL # KERNEL
@ -60,7 +79,11 @@ cp ${TARGET}/helperfs/boot/vmlinuz-${KERNEL_VERSION} ${OUTPUT}/netboot/${ARCH}/v
# DIST # DIST
tar cvf ${OUTPUT}/wmirescue_${ARCH}-netboot.tar -C ${OUTPUT}/netboot . 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} ${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT}
if [ !$QUIET ]; then echo '\n### Executing dist_ipxe --nofirmware ###'; fi
${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware ${SCRIPTDIR}/bin/dist_ipxe ${VERSION} ${OUTPUT} --nofirmware
if [ !$QUIET ]; then echo '\n### Executing dist_iso ###'; fi
${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} ${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 ${SCRIPTDIR}/bin/dist_iso ${VERSION} ${ARCH} ${OUTPUT} --nofirmware