如何使用 preseed 删除包?

Jor*_*tro 13 installation preseed

我正在设置一个自动化的“无问题”预置系统,并以 Dustin Kirkland 的服务器预置为例。

他使用以下行安装三个软件包作为自动安装的一部分:

d-i pkgsel/include string byobu vim openssh-server

我正在寻找与此相反的方法,基本上能够将软件包作为自动安装的一部分删除。

  • 我已经检查了安装指南
  • 我已经检查了这个示例 preseed,但不清楚这是否是每个可用选项的规范列表。

我想我需要用来d-i preseed/late_command string apt-remove packagename清理安装完成后我不想要的东西,但我不确定

hhl*_*hlp 13

在 preseed 配置脚本中没有清除或删除包的选项,但您可以使用此命令....

di preseed/late_command

This command is run just before the install finishes, but when there is
still a usable /target directory. You can chroot to /target and use it
directly, or use the apt-install and in-target commands to easily install
packages and run commands in the target system.
"in-target" means: chroot /target
d-i preseed/late_command string [in-target] foo
Run Code Online (Sandbox Code Playgroud)

例子 :

d-i preseed/late_command string \
            in-target apt-get remove packagename
Run Code Online (Sandbox Code Playgroud)

您还可以运行脚本:

d-i preseed/late_command string \
        in-target wget http://........./postinst.sh -O /root/postinst.sh; \
        in-target /bin/bash /root/postinst.sh
Run Code Online (Sandbox Code Playgroud)

或安装一组 DEB 文件:

d-i preseed/late_command               string \
    for deb in /hd-media/*.deb; do cp $deb /target/tmp; \
    chroot /target dpkg -i /tmp/$(basename $deb); done
Run Code Online (Sandbox Code Playgroud)