mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 07:28:56 +08:00
不重要的优化
This commit is contained in:
20
debian.cfg
20
debian.cfg
@ -1,4 +1,5 @@
|
||||
# shellcheck disable=SC2148,SC2154
|
||||
#_preseed_V1
|
||||
# shellcheck disable=SC1091,SC2148
|
||||
# https://www.debian.org/releases/stable/amd64/apbs04.zh-cn.html
|
||||
# https://www.debian.org/releases/stable/example-preseed.txt
|
||||
# https://preseed.debian.net/debian-preseed/bookworm/amd64-main-full.txt
|
||||
@ -109,6 +110,8 @@ d-i finish-install/reboot_in_progress note
|
||||
# B.5.1. 安装过程中运行用户命令
|
||||
# 注意所有命令都会合并成一行命令
|
||||
|
||||
# 最后的 true; \ 没什么用,只是让 vscode 代码高亮不报错误
|
||||
|
||||
# 有 /cdrom/simple-cdd 才安装 simple-cdd-profiles
|
||||
# 不然安装时 control 脚本会报错:
|
||||
# Loading simple-cdd-profiles failed for unknown reasons
|
||||
@ -118,16 +121,19 @@ d-i preseed/early_command string true; \
|
||||
# debian 11 initrd 没有 xargs awk
|
||||
# debian 12 initrd 没有 xargs
|
||||
# efi 分区大小未改变时,不会被格式化,因此需要手动删除旧系统的 efi 文件
|
||||
# os-prober 卡太久,因此跳过
|
||||
d-i partman/early_command string true; \
|
||||
confhome="$(grep -o 'extra\.confhome=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
|
||||
swapfile=/target/swapfile; \
|
||||
postinst=/var/lib/dpkg/info/bootstrap-base.postinst; \
|
||||
cp $postinst $postinst.orig; \
|
||||
true >$postinst; \
|
||||
|
||||
mem=$(grep ^MemTotal: /proc/meminfo | { read x y z; echo $y; }); \
|
||||
swapfile=/target/swapfile; \
|
||||
mem=$(grep ^MemTotal: /proc/meminfo | { read -r _ y _; echo "$y"; }); \
|
||||
mem=$((mem / 1024)); \
|
||||
swap_size=$((512 - mem)); \
|
||||
[ $swap_size -gt 0 ] && echo "fallocate -l ${swap_size}M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \
|
||||
[ $swap_size -gt 0 ] && echo "fallocate -l ${swap_size}M $swapfile; mkswap $swapfile; swapon $swapfile" >>$postinst; \
|
||||
|
||||
echo "swapoff -a; rm -f $swapfile" >/usr/lib/finish-install.d/95swapoff; \
|
||||
chmod a+x /usr/lib/finish-install.d/95swapoff; \
|
||||
@ -139,7 +145,7 @@ d-i preseed/early_command string true; \
|
||||
debconf-set grub-installer/bootdev "/dev/$xda"; \
|
||||
rm -rf /usr/sbin/fdisk /usr/sbin/sfdisk; \
|
||||
|
||||
ttys=$(wget --tries=5 $confhome/ttys.sh -O- | sh -s console=); \
|
||||
ttys=$(wget --tries=5 "$confhome/ttys.sh" -O- | sh -s console=); \
|
||||
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
||||
|
||||
sh /can_use_cloud_kernel.sh "$xda" || debconf-set base-installer/kernel/image "$(debconf-get base-installer/kernel/image | sed 's/-cloud//')"; \
|
||||
@ -149,11 +155,9 @@ d-i preseed/early_command string true; \
|
||||
|
||||
true >/bin/os-prober
|
||||
|
||||
# os-prober 卡太久,因此跳过
|
||||
|
||||
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
||||
# kali ssh 默认关闭
|
||||
d-i preseed/late_command string \
|
||||
d-i preseed/late_command string true; \
|
||||
in-target systemctl enable ssh; \
|
||||
echo "PermitRootLogin yes" >/target/etc/ssh/sshd_config.d/01-permitrootlogin.conf || \
|
||||
echo "PermitRootLogin yes" >>/target/etc/ssh/sshd_config
|
||||
|
||||
Reference in New Issue
Block a user