小编Tim*_*oop的帖子

传递变量以在 Debian Jessie 安装的 preseed 文件中使用

是否可以通过引导提示向 Debian 安装程序添加变量,以便可以在预置文件中使用该变量?

特别是,我正在尝试解决以下问题:

我们有一个非常广泛的安装后脚本,通常是从服务器下载的。但是现在我想创建 Packer 映像并将安装后脚本与其他 Packer 文件一起保留在版本控制中。为了访问 preseed,我可以在引导命令中执行“preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg”。但现在我希望安装程序从同一位置下载安装后脚本。

目前,安装后挂钩如下所示:

d-i preseed/late_command string wget -q -O /tmp/postinstall.sh http://our.public.server/postinstall.jessie.sh ; sh /tmp/postinstall.sh
Run Code Online (Sandbox Code Playgroud)

理想情况下,我想做类似的事情:

d-i preseed/late_command string wget -q -O /tmp/postinstall.sh http://{{ .HTTPIP }}:{{ .HTTPPort }}/postinstall.jessie.sh ; sh /tmp/postinstall.sh
Run Code Online (Sandbox Code Playgroud)

但是当然 Debian 安装程序不会用所需的值替换那些。所以我在想有可能将类似环境变量的变量传递给我们可以在 preseed 文件中使用的安装程序。

任何提示或提示表示赞赏!

编辑:尝试将 late_command 添加到引导命令中,但没有被接受。

编辑:尝试预置/运行,但它在不允许目标内命令的不同环境中运行。

编辑:这可以是一种解决方法:如何在 debian preseed 文件中通过管道将命令组合在一起?但我更喜欢将脚本放在一个单独的文件中。如果不可能,那也是不可能的。

debian environment-variables preseed packer

9
推荐指数
2
解决办法
5266
查看次数

自动安装 Debian Backports 内核

我有以下固定设置:

Package: linux-image-amd64
Pin: release a=wheezy-backports
Pin-Priority: 1001

Package: *
Pin: release a=wheezy-backports
Pin-Priority: 499
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

$ sudo apt-get install linux-image-amd64
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation: …
Run Code Online (Sandbox Code Playgroud)

package-management debian apt pinning debian-wheezy

8
推荐指数
2
解决办法
8359
查看次数