【发布时间】:2018-06-13 10:09:00
【问题描述】:
我正在使用 preseed 设置 Ubuntu 14.04 的自动安装。我使用虚拟机(virtualBox machine)对此进行了测试。一切都安装得很好,没有任何问题,但我不太清楚如何在 preseed 文件末尾使用 late_command。
我第一次想做的是运行 start.sh 脚本。
我尝试了几次:
代码如下:
d-i preseed/late_command string cp /cdrom/start.sh /target/home/user; in-target chmod 700 /home/user/start.sh; /home/user/start.sh
还有:
d-i preseed/late_command string chroot /target; cp -f /cdrom/start.sh /home/user; chmod 700 /home/user/start.sh;
第三次尝试:
d-i preseed/late_command string cp -f /cdrom/start.sh /home/user; in-target chmod +x /home/user/start.sh; in-target sh start.sh
脚本 start.sh 定义一个命令:
#! /bin/sh
echo "bonjour" > /home/user/bonjour_file
我也试过在新机器上安装后创建一个文件:
d-i preseed/late_command string in-target touch /etc/postinst_user.done
preseed preseed/late_command string in-target touch /etc/postinst_user.done
但它只是在安装的最后挂起。安装正常,但脚本根本没有运行,文件“postinst_user.done”没有创建。
新安装的文件系统是否挂载在/target下?安装中此时的环境是什么样的。这样做的正确方法是什么?
提前谢谢你,
【问题讨论】:
标签: automation debian ubuntu-14.04