Update diy.sh
1、修改解压逻辑,兼容了iStoreOS官网的压缩包解压 2、增加进度条
This commit is contained in:
parent
f4538c9ea3
commit
478c33f922
16
shell/diy.sh
16
shell/diy.sh
@ -91,6 +91,14 @@ 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
|
||||||
|
|
||||||
@ -129,7 +137,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 文件..."
|
||||||
gunzip -k "$file_path"
|
pv "$file_path" | gunzip -c >"${file_path%.*}" || true
|
||||||
img_file="${file_path%.*}"
|
img_file="${file_path%.*}"
|
||||||
|
|
||||||
# 执行转换命令
|
# 执行转换命令
|
||||||
@ -234,8 +242,6 @@ install_fcitx5_chewing() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
declare -a menu_options
|
declare -a menu_options
|
||||||
declare -A commands
|
declare -A commands
|
||||||
menu_options=(
|
menu_options=(
|
||||||
@ -266,11 +272,9 @@ commands=(
|
|||||||
["配置docker为国内镜像"]="configure_docker_mirror"
|
["配置docker为国内镜像"]="configure_docker_mirror"
|
||||||
["安装常用办公必备软件(office、QQ、微信、远程桌面等)"]="install_need_apps"
|
["安装常用办公必备软件(office、QQ、微信、远程桌面等)"]="install_need_apps"
|
||||||
["安装注音输入法(新酷音输入法)"]="install_fcitx5_chewing"
|
["安装注音输入法(新酷音输入法)"]="install_fcitx5_chewing"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
show_menu() {
|
show_menu() {
|
||||||
echo -e "${GREEN_LINE}"
|
echo -e "${GREEN_LINE}"
|
||||||
echo '
|
echo '
|
||||||
|
Loading…
Reference in New Issue
Block a user