新聞中心
B.5. 高級(jí)選項(xiàng)
B.5.1. 安裝過(guò)程中運(yùn)行用戶命令
預(yù)置工具提供了一個(gè)非常強(qiáng)大和靈活的選項(xiàng),可以在安裝過(guò)程的一些環(huán)節(jié)運(yùn)行命令或腳本。

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到通州網(wǎng)站設(shè)計(jì)與通州網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類(lèi)型包括:網(wǎng)站制作、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名注冊(cè)、雅安服務(wù)器托管、企業(yè)郵箱。業(yè)務(wù)覆蓋通州地區(qū)。
當(dāng)目標(biāo)系統(tǒng)的文件系統(tǒng)掛載后,它可以在 /target 中使用。如果使用安裝 CD,則掛載后可以在 /cdrom 中使用。
# d-i preseeding is inherently not secure. Nothing in the installer checks # for attempts at buffer overflows or other exploits of the values of a # preconfiguration file like this one. Only use preconfiguration files from # trusted locations! To drive that home, and because it's generally useful, # here's a way to run any shell command you'd like inside the installer, # automatically. # This first command is run as early as possible, just after # preseeding is read. #d-i preseed/early_command string anna-install some-udeb # This command is run immediately before the partitioner starts. It may be # useful to apply dynamic partitioner preseeding that depends on the state # of the disks (which may not be visible when preseed/early_command runs). #d-i partman/early_command \ # string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" # This command is run just before the install finishes, but when there is # still a usable /target directory. You can chroot to /target and use it # directly, or use the apt-install and in-target commands to easily install # packages and run commands in the target system. #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
B.5.2. 使用預(yù)置修改默認(rèn)值
也可以使用預(yù)置修改問(wèn)題的默認(rèn)答案,但同時(shí)顯示問(wèn)題。這需要在問(wèn)題設(shè)定值之后,必須將 seen 旗標(biāo)重置為 “false”。
d-i foo/bar string value d-i foo/bar seen false
要對(duì)所有問(wèn)題達(dá)到同樣效果,可以通過(guò)在啟動(dòng)引導(dǎo)符后面設(shè)置 preseed/interactive=true。這對(duì)于測(cè)試和調(diào)試您的預(yù)置文件很有幫助。
注意,“d-i” owner 只應(yīng)該用于安裝程序里面的變量。對(duì)于那些屬于目標(biāo)系統(tǒng)軟件包的變量,您應(yīng)該使用軟件包的名字替代。請(qǐng)參考 第 B.2.2 節(jié) “使用引導(dǎo)參數(shù)預(yù)置問(wèn)題的答案” 的腳注。
如果使用引導(dǎo)參數(shù)預(yù)置,您可以通過(guò) “?=” 操作符讓安裝程序詢問(wèn)相關(guān)的問(wèn)題,例如, (或者 foo/bar?=value)。當(dāng)然,這只會(huì)影響在安裝時(shí)顯示出來(lái)的問(wèn)題對(duì)應(yīng)的參數(shù),而不是“內(nèi)部的”參數(shù)。 owner:foo/bar?=value
獲得更多的調(diào)試信息,需使用引導(dǎo)參數(shù) DEBCONF_DEBUG=5。這將讓 debconf 打印更多的細(xì)節(jié),包括當(dāng)前變量設(shè)置和每個(gè)軟件包安裝腳本的進(jìn)度。
B.5.3. 預(yù)置文件鏈
可以在一個(gè)預(yù)置文件里面包含另外的預(yù)置文件。這些文件里面的任何設(shè)置將覆蓋前面加載的設(shè)置。有一種用法,例如,通用的網(wǎng)絡(luò)設(shè)置放在一個(gè)文件,其他規(guī)格的設(shè)置放在另外的文件里面。
# More than one file can be listed, separated by spaces; all will be # loaded. The included files can have preseed/include directives of their # own as well. Note that if the filenames are relative, they are taken from # the same directory as the preconfiguration file that includes them. #d-i preseed/include string x.cfg # The installer can optionally verify checksums of preconfiguration files # before using them. Currently only md5sums are supported, list the md5sums # in the same order as the list of files to include. #d-i preseed/include/checksum string 5da499872becccfeda2c4872f9171c3d # More flexibly, this runs a shell command and if it outputs the names of # preconfiguration files, includes those files. #d-i preseed/include_command \ # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi # Most flexibly of all, this downloads a program and runs it. The program # can use commands such as debconf-set to manipulate the debconf database. # More than one script can be listed, separated by spaces. # Note that if the filenames are relative, they are taken from the same # directory as the preconfiguration file that runs them. #d-i preseed/run string foo.sh
也可以通過(guò)在前面設(shè)置 preseed/url 從 initrd 或者文件預(yù)置鏈載進(jìn)入網(wǎng)絡(luò)預(yù)置。這將使網(wǎng)絡(luò)預(yù)置在網(wǎng)絡(luò)連通時(shí)執(zhí)行。您應(yīng)該小心使用,因?yàn)檫@是兩種預(yù)置,意味著您有機(jī)會(huì)執(zhí)行 preseed/early 命令,第二個(gè)可以在網(wǎng)絡(luò)連通后使用。
網(wǎng)站名稱(chēng):【DebianGNU/Linux安裝手冊(cè)】B.5.?高級(jí)選項(xiàng)
本文鏈接:http://www.dlmjj.cn/article/dpppsip.html


咨詢
建站咨詢
