如何普遍使用 Early_command

如何普遍使用 Early_command

我正在嘗試進行一些自動安裝,並且需要儘早運行一些命令。所以我修改了我的 USB 安裝媒體 (Ubuntu 16.04) 並添加了:

menuentry "Install automatically" {
    set gfxpayload=keep
    linux   /casper/vmlinuz.efi file=/cdrom/auto.seed preseed/early_command=/cdrom/early.sh boot=casper auto=true automatic-ubiquity debug-ubiquity  quiet splash ---
    initrd  /casper/initrd.lz
}

對此進行了解釋: https://wiki.ubuntu.com/UbiquityAutomation 和這裡https://wiki.ubuntu.com/DesktopCDOptions

檔案 Early.sh 位於我的 USB 隨身碟上,作為我的 auto.seed 檔案(載入得很好)。但我的 Early.sh 腳本似乎從未運行過。

我只想將文件複製到實時系統:

#!/bin/bash
cp /cdrom/wlan /root/etc/NetworkManager/system-connections/wlan;
chmod 0600 /root/etc/NetworkManager/system-connections/wlan;

我已將其新增為 /root 前綴,如上面連結中所述。我什至嘗試過:

#!/bin/bash
touch /root/test

當我在partman運行之前停止安裝時,我會得到通常的Live Desktop,並且我希望打開控制台並看到/root/test.但我不這麼認為。

我正在查看 /var/log/syslog,我可以看到啟動參數,但沒有關於 Early_command 的更多日誌行

我的預置文件包含如下行:

d-i preseed/early_command string in-target touch /root/test

我該如何調試這種情況?一遍又一遍地開始是很煩人的。

答案1

我認為,早期命令和晚期命令無所不在,根本不起作用。所以現在我正在使用類似的東西

ubiquity  ubiquity/success_command string \
  cp /cdrom/script /target/root/; \
  chmod 0700 /target/root/script; \
  in-target /root/script; \

這些命令運行良好,我在重新啟動之前設定了 wifi 並對安裝進行了其他修復。

相關內容