debian: 国内使用清华源

This commit is contained in:
bin456789 2023-11-01 22:22:30 +08:00
parent fe12b0f26e
commit 9be484fc54
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 9 additions and 6 deletions

View File

@ -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)"; \

View File

@ -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'"