bug修复:解决pv找不到引起的转换vdi失败问题

https://github.com/wukongdaily/diy-nas-onescript/issues/7
考虑到pv仅仅是一个解压进度条的显示,用处不大。
移除pv依赖并更换解压方式
This commit is contained in:
悟空的日常镜像仓库 2024-04-10 11:00:25 +08:00
parent e54c01c179
commit c9be3c2a61
1 changed files with 1 additions and 9 deletions

View File

@ -168,14 +168,6 @@ install_virtualbox_extpack() {
# 格式转换 # 格式转换
convert_vm_format() { convert_vm_format() {
echo "虚拟机一键格式转换(img2vdi)" echo "虚拟机一键格式转换(img2vdi)"
sudo apt-get update >/dev/null 2>&1
if ! command -v pv &>/dev/null; then
echo "pv is not installed. Installing pv..."
sudo apt-get install pv -y || true
else
echo -e
fi
# 获取用户输入的文件路径 # 获取用户输入的文件路径
read -p "请将待转换的文件拖拽到此处(img|img.zip|img.gz): " file_path read -p "请将待转换的文件拖拽到此处(img|img.zip|img.gz): " file_path
@ -214,7 +206,7 @@ convert_vm_format() {
elif [[ "$file_path" == *.img.gz ]]; then elif [[ "$file_path" == *.img.gz ]]; then
# 如果是 img.gz 文件,先解压 # 如果是 img.gz 文件,先解压
Show 0 "正在解压 img.gz 文件..." Show 0 "正在解压 img.gz 文件..."
pv "$file_path" | gunzip -c >"${file_path%.*}" || true gzip -cd "$file_path" > "${file_path%.*}" || true
img_file="${file_path%.*}" img_file="${file_path%.*}"
# 执行转换命令 # 执行转换命令