windows: 存在只读 sda 时应该安装到第2个硬盘
This commit is contained in:
parent
22779c1dcd
commit
270c128ca6
10
trans.sh
10
trans.sh
@ -1704,6 +1704,16 @@ install_windows() {
|
||||
locale=$(wiminfo $install_wim | grep 'Default Language' | head -1 | awk '{print $NF}')
|
||||
sed -i "s|%arch%|$arch|; s|%image_name%|$image_name|; s|%locale%|$locale|" /tmp/Autounattend.xml
|
||||
|
||||
# sda 只读,放的是 cloud-init 配置,通常 win 有驱动,能识别
|
||||
# 而 vda/nvme/xen 加载驱动后才能识别,所以这时 disk_id 应该为 1
|
||||
if [ -e "/sys/class/block/sda/ro" ] &&
|
||||
[ "$(cat /sys/class/block/sda/ro)" = 0 ]; then
|
||||
disk_id=1
|
||||
else
|
||||
disk_id=0
|
||||
fi
|
||||
sed -i "s|%disk_id%|$disk_id|" /tmp/Autounattend.xml
|
||||
|
||||
# 修改应答文件,分区配置
|
||||
if is_efi; then
|
||||
sed -i "s|%installto_partitionid%|3|" /tmp/Autounattend.xml
|
||||
|
@ -12,7 +12,7 @@
|
||||
<DiskConfiguration>
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
<Disk>
|
||||
<DiskID>0</DiskID>
|
||||
<DiskID>%disk_id%</DiskID>
|
||||
<WillWipeDisk>false</WillWipeDisk>
|
||||
<ModifyPartitions>
|
||||
</ModifyPartitions>
|
||||
@ -31,7 +31,7 @@
|
||||
</InstallFrom>
|
||||
<WillShowUI>OnError</WillShowUI>
|
||||
<InstallTo>
|
||||
<DiskID>0</DiskID>
|
||||
<DiskID>%disk_id%</DiskID>
|
||||
<PartitionID>%installto_partitionid%</PartitionID>
|
||||
</InstallTo>
|
||||
</OSImage>
|
||||
|
Loading…
Reference in New Issue
Block a user