mirror of
https://github.com/bin456789/reinstall.git
synced 2025-12-10 07:28:56 +08:00
kali: 支持安装 kali
This commit is contained in:
29
debian.cfg
29
debian.cfg
@ -19,13 +19,14 @@ d-i netcfg/hostname string localhost
|
||||
|
||||
# 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/
|
||||
# d-i mirror/http/hostname string deb.debian.org
|
||||
|
||||
# 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@@@
|
||||
# kali 需要下面这行,否则会提示输入用户名
|
||||
d-i passwd/root-login boolean true
|
||||
|
||||
# B.4.6. 时钟与时区设置
|
||||
d-i time/zone string Asia/Shanghai
|
||||
@ -58,7 +59,6 @@ d-i partman-efi/non_efi_system boolean true
|
||||
# 选择 true 就一直死循环
|
||||
d-i partman-basicfilesystems/no_swap boolean false
|
||||
|
||||
|
||||
# 最小值 膨胀权重 最大值
|
||||
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes/atomic?ref_type=heads
|
||||
# https://salsa.debian.org/installer-team/partman-auto/-/blob/master/recipes-amd64-efi/atomic?ref_type=heads
|
||||
@ -81,8 +81,8 @@ d-i apt-setup/non-free boolean true
|
||||
d-i apt-setup/non-free-firmware boolean true
|
||||
d-i apt-setup/contrib boolean true
|
||||
d-i apt-setup/enable-source-repositories boolean false
|
||||
d-i apt-setup/services-select multiselect security, updates
|
||||
d-i apt-setup/security_host string security.debian.org
|
||||
# kali 不要设置
|
||||
# d-i apt-setup/security_host string security.debian.org
|
||||
|
||||
# B.4.10. 选择软件包
|
||||
tasksel tasksel/first multiselect ssh-server
|
||||
@ -97,24 +97,29 @@ d-i finish-install/reboot_in_progress note
|
||||
|
||||
# B.4.13. 预置其他的软件包
|
||||
|
||||
# 其他设置
|
||||
# d-i anna/standard_modules boolean false
|
||||
# d-i anna/choose_modules string network-console
|
||||
# d-i network-console/password password 123@@@
|
||||
# d-i network-console/password-again password 123@@@
|
||||
|
||||
# B.5.1. 安装过程中运行用户命令
|
||||
d-i preseed/early_command string \
|
||||
hostname="$(grep -o 'extra\.deb_hostname=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
debconf-set mirror/http/hostname "$hostname"
|
||||
# d-i preseed/early_command string
|
||||
|
||||
# debian 11 initrd 没有 xargs awk
|
||||
# debian 12 initrd 没有 xargs
|
||||
d-i partman/early_command string \
|
||||
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; \
|
||||
|
||||
mem=$(grep ^MemTotal: /proc/meminfo | { read x y z; 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; \
|
||||
|
||||
echo "swapoff -a; rm -f $swapfile" >/usr/lib/finish-install.d/95swapoff; \
|
||||
chmod a+x /usr/lib/finish-install.d/95swapoff; \
|
||||
|
||||
@ -126,9 +131,7 @@ d-i partman/early_command string \
|
||||
ttys=$(wget --tries=5 $confhome/ttys.sh -O- | sh -s console=); \
|
||||
debconf-set debian-installer/add-kernel-opts "$ttys"; \
|
||||
|
||||
kernel="$(grep -o 'extra\.kernel=[^ ]*' /proc/cmdline | cut -d= -f2)"; \
|
||||
. /can_use_cloud_kernel.sh || kernel=$(echo "$kernel" | sed 's/-cloud//'); \
|
||||
debconf-set base-installer/kernel/image "$kernel"; \
|
||||
. /can_use_cloud_kernel.sh || debconf-set base-installer/kernel/image $(debconf-get base-installer/kernel/image | sed 's/-cloud//'); \
|
||||
|
||||
[ -d /sys/firmware/efi ] && debconf-set partman-auto/expert_recipe "$(debconf-get partman-auto/expert_recipe_efi)"; \
|
||||
[ -d /sys/firmware/efi ] || debconf-set partman-auto/expert_recipe "$(debconf-get partman-auto/expert_recipe_bios)"; \
|
||||
@ -138,6 +141,8 @@ d-i partman/early_command string \
|
||||
# os-prober 卡太久,因此跳过
|
||||
|
||||
# debian 10 没有 /target/etc/ssh/sshd_config.d/ 文件夹
|
||||
# kali ssh 默认关闭
|
||||
d-i preseed/late_command string \
|
||||
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