Jul 052012
 

今天看到一个preseed文件,很有想法,简单点说,就是安装的时候,把脚本copy到硬盘上,修改rc.local,让机器装完系统重启的时候,安装相关内容。脚本最后一步,就是删除rc.local 的设置,实现第一次启动运行,只运行一次。

https://help.ubuntu.com/community/InstallCDCustomization/PreseedExamples

 

d-i     preseed/late_command            string cp -a /cdrom/preseed/install.sh \
/target/root; sed -i 's_exit 0_sh /root/install.sh_' /target/etc/rc.local; 

install.sh 脚本如下

INSTALL="apt-get install -y"
REMOVE="apt-get remove -y"

apt-get update

# email
$INSTALL exim4-daemon-heavy mailx mailgraph

# etc - loads cut

sed -i 's_sh /root/install.sh_exit 0_' /etc/rc.local

echo "Installation complete."

 Leave a Reply

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.