core: 提前扩容时用命令获取最后一个分区的编号

This commit is contained in:
bin456789
2023-10-22 18:54:30 +08:00
parent dbb73f0733
commit 4ce85719d4

View File

@ -1352,8 +1352,8 @@ resize_after_install_cloud_image() {
apk add parted apk add parted
if parted /dev/$xda -s print 2>&1 | grep 'Not all of the space'; then if parted /dev/$xda -s print 2>&1 | grep 'Not all of the space'; then
printf "fix" | parted /dev/$xda print ---pretend-input-tty printf "fix" | parted /dev/$xda print ---pretend-input-tty
# TODO: 获取 ext4 分区编号
[ "$distro" = debian ] && system_part_num=1 || system_part_num=3 system_part_num=$(parted /dev/$xda -m print | tail -1 | cut -d: -f1)
printf "yes" | parted /dev/$xda resizepart $system_part_num 100% ---pretend-input-tty printf "yes" | parted /dev/$xda resizepart $system_part_num 100% ---pretend-input-tty
update_part /dev/$xda update_part /dev/$xda