mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-31 19:08:07 +08:00
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}')
|
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
|
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
|
if is_efi; then
|
||||||
sed -i "s|%installto_partitionid%|3|" /tmp/Autounattend.xml
|
sed -i "s|%installto_partitionid%|3|" /tmp/Autounattend.xml
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<DiskConfiguration>
|
<DiskConfiguration>
|
||||||
<WillShowUI>OnError</WillShowUI>
|
<WillShowUI>OnError</WillShowUI>
|
||||||
<Disk>
|
<Disk>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>%disk_id%</DiskID>
|
||||||
<WillWipeDisk>false</WillWipeDisk>
|
<WillWipeDisk>false</WillWipeDisk>
|
||||||
<ModifyPartitions>
|
<ModifyPartitions>
|
||||||
</ModifyPartitions>
|
</ModifyPartitions>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
</InstallFrom>
|
</InstallFrom>
|
||||||
<WillShowUI>OnError</WillShowUI>
|
<WillShowUI>OnError</WillShowUI>
|
||||||
<InstallTo>
|
<InstallTo>
|
||||||
<DiskID>0</DiskID>
|
<DiskID>%disk_id%</DiskID>
|
||||||
<PartitionID>%installto_partitionid%</PartitionID>
|
<PartitionID>%installto_partitionid%</PartitionID>
|
||||||
</InstallTo>
|
</InstallTo>
|
||||||
</OSImage>
|
</OSImage>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user