Speed up initrd compression (closes #25)

Other: Use printf instead of echo for error and warning
pull/29/head
Bohan Yang 4 years ago
parent cdf7db8b60
commit 1f5d2e07ec
  1. 15
      debi.sh

@ -4,10 +4,15 @@
set -eu set -eu
err() { err() {
echo "\nError: $1.\n" 1>&2 printf "\nError: %s.\n" "$1" 1>&2
exit 1 exit 1
} }
warn() {
printf "\nWarning: %s.\nContinuing with the default...\n" "$1" 1>&2
sleep 5
}
command_exists() { command_exists() {
command -v "$1" > /dev/null 2>&1 command -v "$1" > /dev/null 2>&1
} }
@ -145,8 +150,7 @@ has_cloud_kernel() {
esac esac
local tmp; tmp=''; [ "$bpo_kernel" = true ] && tmp='-backports' local tmp; tmp=''; [ "$bpo_kernel" = true ] && tmp='-backports'
echo "\nWarning: No cloud kernel is available for $architecture/$suite$tmp.\nContinuing with the default...\n" 1>&2 warn "No cloud kernel is available for $architecture/$suite$tmp"
sleep 5
return 1 return 1
} }
@ -156,8 +160,7 @@ has_backports() {
stretch|oldoldstable|buster|oldstable|bullseye|stable|bookworm|testing) return stretch|oldoldstable|buster|oldstable|bullseye|stable|bookworm|testing) return
esac esac
echo "\nWarning: No backports kernel is available for $suite.\nContinuing with the default...\n" 1>&2 warn "No backports kernel is available for $suite"
sleep 5
return 1 return 1
} }
@ -715,7 +718,7 @@ save_grub_cfg='cat'
gzip -d initrd.gz gzip -d initrd.gz
# cpio reads a list of file names from the standard input # cpio reads a list of file names from the standard input
echo preseed.cfg | cpio -o -H newc -A -F initrd echo preseed.cfg | cpio -o -H newc -A -F initrd
gzip -9 initrd gzip -1 initrd
mkdir -p /etc/default/grub.d mkdir -p /etc/default/grub.d
tee /etc/default/grub.d/zz-debi.cfg 1>&2 << EOF tee /etc/default/grub.d/zz-debi.cfg 1>&2 << EOF

Loading…
Cancel
Save