From 41b5ccc3ecd10e783ad82d64813808728c4f4348 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Wed, 22 May 2024 21:39:00 +0800 Subject: [PATCH] =?UTF-8?q?kali:=20=E8=BF=98=E5=8E=9F=20netinst.iso=20?= =?UTF-8?q?=E7=9A=84=20simple-cdd=20=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian.cfg | 9 ++++++++- reinstall.sh | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/debian.cfg b/debian.cfg index ddfaff3..fceda8e 100644 --- a/debian.cfg +++ b/debian.cfg @@ -2,6 +2,7 @@ # 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 +# 需要留意 kali initrd 自带的 /preseed.cfg # 下面这行语句无效,因为本行后面有反斜杠,前面有空格(安装器认为不算注释)\ d-i debian-installer/locale string en_US @@ -106,7 +107,13 @@ d-i finish-install/reboot_in_progress note # d-i network-console/password-again password 123@@@ # B.5.1. 安装过程中运行用户命令 -# d-i preseed/early_command string +# 注意所有命令都会合并成一行命令 + +# 有 /cdrom/simple-cdd 才安装 simple-cdd-profiles +# 不然安装时 control 脚本会报错: +# Loading simple-cdd-profiles failed for unknown reasons +d-i preseed/early_command string true; \ + if [ -d /cdrom/simple-cdd ]; then anna-install simple-cdd-profiles; fi # debian 11 initrd 没有 xargs awk # debian 12 initrd 没有 xargs diff --git a/reinstall.sh b/reinstall.sh index d44c69b..1e1f1a0 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -1908,6 +1908,7 @@ build_nextos_cmdline() { # kali 安装好后网卡是 eth0 这种格式,但安装时不是 if [ "$nextos_distro" = kali ]; then nextos_cmdline+=" net.ifnames=0" + nextos_cmdline+=" simple-cdd/profiles=kali" fi elif is_distro_like_redhat $nextos_distro; then # redhat @@ -2157,6 +2158,19 @@ EOF echo 'export DEBCONF_DROP_TRANSLATIONS=1' | insert_into_file lib/debian-installer/menu before 'exec debconf' + # 还原 kali netinst.iso 的 simple-cdd 机制 + # 主要用于调用 kali.postinst 设置 zsh 为默认 shell + # 但 mini.iso 又没有这种机制 + # https://gitlab.com/kalilinux/build-scripts/live-build-config/-/raw/master/kali-config/common/includes.installer/kali-finish-install?ref_type=heads + # https://salsa.debian.org/debian/simple-cdd/-/blob/master/debian/14simple-cdd?ref_type=heads + # https://http.kali.org/pool/main/s/simple-cdd/simple-cdd-profiles_0.6.9_all.udeb + if [ "$distro" = kali ]; then + # 但我们没有使用 iso,因此没有 kali.postinst,需要另外下载 + mkdir -p cdrom/simple-cdd + curl -Lo cdrom/simple-cdd/kali.postinst https://gitlab.com/kalilinux/build-scripts/live-build-config/-/raw/master/kali-config/common/includes.installer/kali-finish-install?ref_type=heads + chmod a+x cdrom/simple-cdd/kali.postinst + fi + # 提前下载 fdisk # 因为 fdisk-udeb 包含 fdisk 和 sfdisk,提前下载可减少占用 mkdir_clear $tmp/fdisk