我需要知道如何通过d-i early / command或d-i preseed / run将这个添加到preseeding中,以便在/ proc / cmdline参数中将我的镜像设置在preseed.cfg中.
如果我做:
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
它失败.
它在CentOS kickstart%pre部分中运行良好,但我不知道如何通过debian / ubuntu preseeding做到这一点.
经过对debconf的一些研究后,我提出了这个解决方案:
原文链接:https://www.f2er.com/ubuntu/348642.html在preseed.cfg中,您可以通过以下方式调用脚本:
d-i preseed/run string ws/ubuntu.sh // subdir from preseed file location
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
效果很好@ 12.04.2 LTS!