diff --git a/debian.cfg b/debian.cfg index 1a10008..68bdb54 100644 --- a/debian.cfg +++ b/debian.cfg @@ -67,8 +67,8 @@ d-i finish-install/reboot_in_progress note # B.5.1. 安装过程中运行用户命令 d-i preseed/early_command string \ - wget http://www.cloudflare.com/cdn-cgi/trace -O- | grep -x 'loc=CN' && hostname=ftp.cn.debian.org || hostname=deb.debian.org; \ - debconf-set mirror/http/hostname $hostname + hostname="$(grep -o 'extra\.deb_hostname=[^ ]*' /proc/cmdline | cut -d= -f2)"; \ + debconf-set mirror/http/hostname "$hostname" d-i partman/early_command string \ debconf-set partman-auto/disk "$(list-devices disk | head -n1)"; \ diff --git a/reinstall.sh b/reinstall.sh index 21eea15..586d376 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -311,11 +311,13 @@ setos() { else # 传统安装 if is_in_china; then - hostname=ftp.cn.debian.org + # 部分国内机无法访问 ftp.cn.debian.org + deb_hostname=mirrors.tuna.tsinghua.edu.cn else - hostname=deb.debian.org + deb_hostname=deb.debian.org fi - mirror=http://$hostname/debian/dists/$codename/main/installer-$basearch_alt/current/images/netboot/debian-installer/$basearch_alt + + mirror=http://$deb_hostname/debian/dists/$codename/main/installer-$basearch_alt/current/images/netboot/debian-installer/$basearch_alt eval ${step}_vmlinuz=$mirror/linux eval ${step}_initrd=$mirror/initrd.gz eval ${step}_ks=$confhome/debian.cfg @@ -325,6 +327,7 @@ setos() { [ "$releasever" -eq 10 ] && [ "$basearch_alt" = amd64 ] && flavour= # shellcheck disable=SC2034 kernel=linux-image$flavour-$basearch_alt + fi } @@ -1083,7 +1086,7 @@ build_finalos_cmdline() { } build_extra_cmdline() { - for key in confhome hold cloud_image kernel; do + for key in confhome hold cloud_image kernel deb_hostname; do value=${!key} if [ -n "$value" ]; then extra_cmdline+=" extra.$key='$value'"