添加dd功能

This commit is contained in:
bin456789
2023-06-04 19:12:57 +08:00
parent 270773f473
commit 1b8fe2637f
3 changed files with 39 additions and 4 deletions

View File

@ -89,6 +89,23 @@ if [ "$distro" = "alpine" ]; then
export BOOTLOADER="grub"
printf 'y' | setup-disk -m sys $kernel_opt -s 0 /dev/$xda
exec reboot
elif [ "$distro" = "dd" ]; then
filetype=$(echo $ddimg | awk -F. '{print $NF}')
case "$filetype" in
gz) prog=gzip ;;
xz) prog=xz ;;
esac
if [ -n "$prog" ]; then
# alpine busybox 自带 gzip xz但官方版也许性能更好
apk add curl $prog
curl -L $ddimg | $prog -dc >/dev/$xda
else
echo 'Not supported'
sleep 1m
fi
exec reboot
fi
download() {