mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +08:00
core: dd 时只处理 windows 系统的内容
This commit is contained in:
parent
6976219544
commit
ed9766de37
18
trans.sh
18
trans.sh
@ -1032,16 +1032,24 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
modify_os_on_disk() {
|
modify_os_on_disk() {
|
||||||
|
only_process=$1
|
||||||
|
|
||||||
apk add util-linux udev hdparm lsblk
|
apk add util-linux udev hdparm lsblk
|
||||||
rc-service udev start
|
rc-service udev start
|
||||||
update_part /dev/$xda
|
update_part /dev/$xda
|
||||||
|
|
||||||
|
# dd linux 的时候不用修改硬盘内容
|
||||||
|
if [ "$distro" = "dd" ] && ! lsblk -f /dev/$xda | grep ntfs; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
mkdir -p /os
|
mkdir -p /os
|
||||||
# 按分区容量大到小,依次寻找系统分区
|
# 按分区容量大到小,依次寻找系统分区
|
||||||
for part in $(lsblk /dev/$xda --sort SIZE -no NAME | sed '$d' | tac); do
|
for part in $(lsblk /dev/$xda --sort SIZE -no NAME | sed '$d' | tac); do
|
||||||
# btrfs挂载的是默认子卷,如果没有默认子卷,挂载的是根目录
|
# btrfs挂载的是默认子卷,如果没有默认子卷,挂载的是根目录
|
||||||
# fedora 云镜像没有默认子卷,且系统在root子卷中
|
# fedora 云镜像没有默认子卷,且系统在root子卷中
|
||||||
if mount -o ro /dev/$part /os; then
|
if mount -o ro /dev/$part /os; then
|
||||||
|
if [ "$only_process" = linux ]; then
|
||||||
if etc_dir=$({ ls -d /os/etc/ || ls -d /os/*/etc/; } 2>/dev/null); then
|
if etc_dir=$({ ls -d /os/etc/ || ls -d /os/*/etc/; } 2>/dev/null); then
|
||||||
os_dir=$(dirname $etc_dir)
|
os_dir=$(dirname $etc_dir)
|
||||||
# 重新挂载为读写
|
# 重新挂载为读写
|
||||||
@ -1049,7 +1057,7 @@ modify_os_on_disk() {
|
|||||||
modify_linux $os_dir
|
modify_linux $os_dir
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
elif [ "$only_process" = windows ]; then
|
||||||
# find 有时会报 I/O error
|
# find 有时会报 I/O error
|
||||||
if ls -d /os/*/ | grep -i '/windows/' 2>/dev/null; then
|
if ls -d /os/*/ | grep -i '/windows/' 2>/dev/null; then
|
||||||
# 重新挂载为读写、忽略大小写
|
# 重新挂载为读写、忽略大小写
|
||||||
@ -1059,7 +1067,7 @@ modify_os_on_disk() {
|
|||||||
modify_windows /os
|
modify_windows /os
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
umount /os
|
umount /os
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -1904,7 +1912,7 @@ if [ "$distro" = "alpine" ]; then
|
|||||||
install_alpine
|
install_alpine
|
||||||
elif [ "$distro" = "dd" ] && [ "$img_type" != "qemu" ]; then
|
elif [ "$distro" = "dd" ] && [ "$img_type" != "qemu" ]; then
|
||||||
dd_gzip_xz
|
dd_gzip_xz
|
||||||
modify_os_on_disk
|
modify_os_on_disk windows
|
||||||
elif is_use_cloud_image; then
|
elif is_use_cloud_image; then
|
||||||
if [ "$img_type" = "qemu" ]; then
|
if [ "$img_type" = "qemu" ]; then
|
||||||
create_part
|
create_part
|
||||||
@ -1916,13 +1924,13 @@ elif is_use_cloud_image; then
|
|||||||
# debian ubuntu fedora opensuse arch gentoo
|
# debian ubuntu fedora opensuse arch gentoo
|
||||||
dd_qcow
|
dd_qcow
|
||||||
resize_after_install_cloud_image
|
resize_after_install_cloud_image
|
||||||
modify_os_on_disk
|
modify_os_on_disk linux
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# gzip xz 格式的云镜像,暂时没用到
|
# gzip xz 格式的云镜像,暂时没用到
|
||||||
dd_gzip_xz
|
dd_gzip_xz
|
||||||
resize_after_install_cloud_image
|
resize_after_install_cloud_image
|
||||||
modify_os_on_disk
|
modify_os_on_disk linux
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# 安装模式: windows windows ubuntu 红帽
|
# 安装模式: windows windows ubuntu 红帽
|
||||||
|
Loading…
x
Reference in New Issue
Block a user