pull/8/head
Bohan Yang 5 years ago committed by GitHub
parent e8e93767a9
commit f04c54e06e
  1. 26
      debi.sh

@ -220,7 +220,7 @@ while [ $# -gt 0 ]; do
upgrade=full-upgrade upgrade=full-upgrade
;; ;;
--eth) --eth)
kernel_params=' net.ifnames=0 biosdevname=0' kernel_params="$kernel_params net.ifnames=0 biosdevname=0"
;; ;;
--bbr) --bbr)
bbr=true bbr=true
@ -270,9 +270,9 @@ save_preseed='cat'
if [ "$dry_run" = false ]; then if [ "$dry_run" = false ]; then
[ "$(id -u)" -ne 0 ] && err 'root privilege is required' [ "$(id -u)" -ne 0 ] && err 'root privilege is required'
rm -rf "$installer_directory" rm -rf "$installer_directory"
mkdir -p "$installer_directory/initrd" mkdir -p "$installer_directory"
cd "$installer_directory" cd "$installer_directory"
save_preseed='tee -a initrd/preseed.cfg' save_preseed='tee -a preseed.cfg'
fi fi
$save_preseed << 'EOF' $save_preseed << 'EOF'
@ -560,8 +560,8 @@ if [ "$dry_run" = false ]; then
wget "$base_url/linux" "$base_url/initrd.gz" wget "$base_url/linux" "$base_url/initrd.gz"
[ "$firmware" = true ] && wget "$firmware_url" [ "$firmware" = true ] && wget "$firmware_url"
elif command_exists curl; then elif command_exists curl; then
curl -f -L -O "$base_url/linux" -O "$base_url/initrd.gz" curl -fLO "$base_url/linux" -O "$base_url/initrd.gz"
[ "$firmware" = true ] && curl -f -L -O "$firmware_url" [ "$firmware" = true ] && curl -fLO "$firmware_url"
elif command_exists busybox && busybox wget --help > /dev/null 2>&1; then elif command_exists busybox && busybox wget --help > /dev/null 2>&1; then
busybox wget "$base_url/linux" "$base_url/initrd.gz" busybox wget "$base_url/linux" "$base_url/initrd.gz"
[ "$firmware" = true ] && busybox wget "$firmware_url" [ "$firmware" = true ] && busybox wget "$firmware_url"
@ -569,13 +569,10 @@ if [ "$dry_run" = false ]; then
err 'Could not find "wget" or "curl" or "busybox wget" command to download files' err 'Could not find "wget" or "curl" or "busybox wget" command to download files'
fi fi
cd initrd gzip -d initrd.gz
# cpio reads a list of file names from the standard input
gzip -d -c ../initrd.gz | cpio -i -d --no-absolute-filenames echo preseed.cfg | cpio -o -H newc -A -F initrd
[ "$firmware" = true ] && gzip -d -c ../firmware.cpio.gz | cpio -i -d --no-absolute-filenames gzip -9 initrd
find . | cpio -o -H newc | gzip -9 > ../initrd.gz
cd ..
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
@ -609,12 +606,15 @@ installer_directory="$boot_directory$installer"
mem=$(grep ^MemTotal: /proc/meminfo | { read -r x y z; echo "$y"; }) mem=$(grep ^MemTotal: /proc/meminfo | { read -r x y z; echo "$y"; })
[ $((mem / 1024)) -lt 483 ] && kernel_params="$kernel_params lowmem/low=" [ $((mem / 1024)) -lt 483 ] && kernel_params="$kernel_params lowmem/low="
initrd="$installer_directory/initrd.gz"
[ "$firmware" = true ] && initrd="$initrd $installer_directory/firmware.cpio.gz"
$save_grub_cfg 1>&2 << EOF $save_grub_cfg 1>&2 << EOF
menuentry 'Debian Installer' --id debi { menuentry 'Debian Installer' --id debi {
insmod part_msdos insmod part_msdos
insmod part_gpt insmod part_gpt
insmod ext2 insmod ext2
linux $installer_directory/linux$kernel_params linux $installer_directory/linux$kernel_params
initrd $installer_directory/initrd.gz initrd $initrd
} }
EOF EOF

Loading…
Cancel
Save