2023-08-08 23:21:28 +08:00
|
|
|
# shellcheck disable=SC2148,SC2154
|
2023-07-22 21:45:47 +08:00
|
|
|
# https://www.debian.org/releases/stable/amd64/apbs04.zh-cn.html
|
2023-08-27 23:46:48 +08:00
|
|
|
# https://www.debian.org/releases/stable/example-preseed.txt
|
|
|
|
# https://preseed.debian.net/debian-preseed/bookworm/amd64-main-full.txt
|
2023-08-08 23:21:28 +08:00
|
|
|
|
2023-05-17 22:54:26 +08:00
|
|
|
# B.4.1. 本地化
|
|
|
|
d-i debian-installer/locale string en_US
|
|
|
|
d-i keyboard-configuration/xkb-keymap select us
|
|
|
|
|
|
|
|
# B.4.2. 网络设置
|
|
|
|
d-i netcfg/get_hostname string unassigned-hostname
|
|
|
|
d-i netcfg/get_domain string unassigned-domain
|
|
|
|
d-i netcfg/hostname string localhost
|
|
|
|
|
|
|
|
# B.4.3. 网络控制台
|
|
|
|
|
|
|
|
# B.4.4. 镜像设置
|
|
|
|
d-i mirror/country string manual
|
|
|
|
d-i mirror/http/hostname string deb.debian.org
|
|
|
|
d-i mirror/http/directory string /debian/
|
|
|
|
|
|
|
|
# B.4.5. 帐号设置
|
|
|
|
d-i passwd/make-user boolean false
|
|
|
|
d-i passwd/root-password password 123@@@
|
|
|
|
d-i passwd/root-password-again password 123@@@
|
|
|
|
|
|
|
|
# B.4.6. 时钟与时区设置
|
|
|
|
d-i clock-setup/utc boolean true
|
|
|
|
d-i time/zone string Asia/Shanghai
|
|
|
|
d-i clock-setup/ntp boolean true
|
|
|
|
|
|
|
|
# B.4.7. 分区
|
|
|
|
d-i partman-auto/method string regular
|
|
|
|
d-i partman-auto/choose_recipe select atomic
|
|
|
|
d-i partman-partitioning/confirm_write_new_label boolean true
|
|
|
|
d-i partman/choose_partition select finish
|
|
|
|
d-i partman/confirm boolean true
|
|
|
|
d-i partman/confirm_nooverwrite boolean true
|
|
|
|
d-i partman-basicfilesystems/no_swap boolean true
|
|
|
|
|
|
|
|
# B.4.8. 基本系统安装
|
|
|
|
|
|
|
|
# B.4.9. 设置 apt
|
2023-08-27 23:46:48 +08:00
|
|
|
d-i apt-setup/non-free boolean false
|
|
|
|
d-i apt-setup/non-free-firmware boolean true
|
|
|
|
d-i apt-setup/contrib boolean false
|
2023-05-17 22:54:26 +08:00
|
|
|
d-i apt-setup/enable-source-repositories boolean false
|
2023-08-27 23:46:48 +08:00
|
|
|
d-i apt-setup/services-select multiselect security, updates
|
2023-05-17 22:54:26 +08:00
|
|
|
d-i apt-setup/security_host string security.debian.org
|
|
|
|
|
|
|
|
# B.4.10. 选择软件包
|
|
|
|
tasksel tasksel/first multiselect ssh-server
|
|
|
|
d-i pkgsel/upgrade select none
|
|
|
|
|
|
|
|
# B.4.11. 安装 bootloader
|
|
|
|
d-i grub-installer/only_debian boolean true
|
|
|
|
d-i grub-installer/with_other_os boolean false
|
2023-06-05 19:41:32 +08:00
|
|
|
d-i grub-installer/bootdev string default
|
2023-05-17 22:54:26 +08:00
|
|
|
d-i grub2/force_efi_extra_removable boolean true
|
|
|
|
|
|
|
|
# B.4.12. 完成安装
|
|
|
|
d-i finish-install/reboot_in_progress note
|
|
|
|
|
|
|
|
# B.4.13. 预置其他的软件包
|
|
|
|
|
|
|
|
# B.5.1. 安装过程中运行用户命令
|
|
|
|
d-i preseed/early_command string \
|
2023-07-22 21:45:47 +08:00
|
|
|
wget http://www.cloudflare.com/cdn-cgi/trace -O- | grep -x 'loc=CN' && hostname=ftp.cn.debian.org || hostname=deb.debian.org; \
|
2023-05-17 22:54:26 +08:00
|
|
|
debconf-set mirror/http/hostname $hostname
|
|
|
|
|
|
|
|
d-i partman/early_command string \
|
2023-08-27 23:52:06 +08:00
|
|
|
debconf-set partman-auto/disk "$(list-devices disk | head -n1)"; \
|
2023-05-17 22:54:26 +08:00
|
|
|
|
2023-08-08 23:21:28 +08:00
|
|
|
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
|
|
|
ttys=$(wget $confhome/ttys.sh -O- | sh -s console=); \
|
2023-08-27 23:52:06 +08:00
|
|
|
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
|
|
|
|
|
|
|
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
|
|
|
debconf-set base-installer/kernel/image "$kernel"
|
2023-08-08 23:21:28 +08:00
|
|
|
|
2023-07-22 21:44:58 +08:00
|
|
|
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
2023-05-17 22:54:26 +08:00
|
|
|
d-i preseed/late_command string \
|
|
|
|
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \
|
2023-07-22 21:44:58 +08:00
|
|
|
echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config
|