使用 preseed 在 Debian 安装完成之前运行脚本 [英] Running a script just before installation of Debian finishes using preseed

查看:22
本文介绍了使用 preseed 在 Debian 安装完成之前运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Debian Wheezy 安装完成之前运行一个脚本.我知道d-i preseed/late-command",即.在安装完成之前使用运行命令.但我面临一个问题.我无法弄清楚在 iso 文件中复制脚本的位置.我尝试了以下两种方法:

I am trying to run a script just before the installation of Debian Wheezy finishes. I am aware of "d-i preseed/late-command", viz. used run commands before the installation finishes. But I am facing a problem. I cannot figure out where to copy my script in the iso file. I tried following two approaches:

  1. 我试图将我的脚本复制到 initrd.gz 的根目录中(/install.386/initrd.gz) 文件并在preseed.cfg: d-i preseed/late-command in-target sh/my_script.sh
  2. 我还尝试将我的脚本复制到 iso 的根目录中文件并在 preseed.cfg 中进行了以下更改:d-ipreseed/late-command in-target sh/media/cdrom/my_script.sh

那么,将文件复制到哪里(在我的脚本中)以便我可以在后期命令中使用它?

So, where to copy a file (here in my script) so that I can use it in late-command?

推荐答案

此解决方案基于您使用 USB 安装操作系统的事实,并且您将在 USB 的根目录中有一个名为 files,您将在其中拥有文件 preseed.cfg 和一个名为 run.sh 的可执行文件.

This solution is based on the fact that you use a USB to install the OS, and that you will have in the root of the USB a folder called files where you will have the file preseed.cfg and an executable called run.sh.

此命令会将文件 run.sh 复制到用户 root 的根目录并在那里执行脚本.

This command will copy the file run.sh to the root of the user root and there it will execute the script.

d-i preseed/late_command string cp/cdrom/files/run.sh/target/root/;chmod +x/target/root/run.sh;目标内/bin/bash/root/run.sh

在此之后,您可以使用 rm 删除文件.您也可以直接从 USB 运行脚本(无需复制),但经过一些测试,我已经验证它会导致人为错误

After this you can use rm to delete the file. You can also run the script directly from the USB (without copying it), but after some tests I have verified that it can induce human errors

这篇关于使用 preseed 在 Debian 安装完成之前运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆