man*_*nga 7 ubuntu debian preseed
我需要知道如何通过 di early/command 或 di preseed/run 将其添加到 preseed 中,以便preseed.cfg
从/proc/cmdline
参数中设置我的镜像。
如果我做:
d-i preseed/run string ws/ubuntu.sh
#!/bin/sh
for x in `cat /proc/cmdline`; do
case $x in RPHOST*)
eval $x
d-i mirror/http/hostname string ${RPHOST}
d-i mirror/http/mirror string ${RPHOST}
d-i apt-setup/security_host string ${RPHOST}
;;
esac;
done
Run Code Online (Sandbox Code Playgroud)
它失败。
它在 CentOS 启动%pre
部分运行良好,但我不知道如何通过 debian/ubuntu 预置来实现。
在对 debconf 进行了一些研究后,我想出了这个解决方案:
在您的 preseed.cfg 中,您通过以下方式调用脚本:
d-i preseed/run string ws/ubuntu.sh // subdir from preseed file location
Run Code Online (Sandbox Code Playgroud)
ubuntu.sh 的内容:
#!/bin/sh
echo "Start ubuntu.sh runscript" >> /var/log/syslog
for x in `cat /proc/cmdline`; do
case $x in RPHOST*)
eval $x
HOST=$RPHOST
echo "d-i mirror/http/hostname string ${HOST}" > /tmp/mirror.cfg
echo "d-i mirror/http/mirror string ${HOST}" >> /tmp/mirror.cfg
echo "d-i apt-setup/security_host string ${HOST}" >> /tmp/mirror.cfg
;;
esac;
done
// add´s values to /var/lib/cdebconf/question.dat
debconf-set-selections /tmp/mirror.cfg
Run Code Online (Sandbox Code Playgroud)
在 12.04.2 LTS 上运行良好!
归档时间: |
|
查看次数: |
3252 次 |
最近记录: |