dd: 参数 ddimg 改成 img

This commit is contained in:
bin456789 2023-06-05 19:45:07 +08:00
parent 2e10b9390e
commit ecc3134479
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
3 changed files with 11 additions and 11 deletions

View File

@ -22,7 +22,7 @@ bash reinstall.sh centos-7 (或其他系统)
bash reinstall.sh windows --iso=https://example.com/zh-cn_windows_10_enterprise_ltsc_2021_x64_dvd_033b7312.iso --image-name='Windows 10 Enterprise LTSC 2021'
dd:
bash reinstall.sh dd --ddimg=https://example.com/xxx.gz
bash reinstall.sh dd --img=https://example.com/xxx.gz
重启:
reboot

View File

@ -128,13 +128,13 @@ setos() {
}
setos_dd() {
if [ -z "$ddimg" ]; then
echo "dd need --ddimg"
if [ -z "$img" ]; then
echo "dd need --img"
exit 1
fi
test_url $ddimg 'xz|gz'
eval "${step}_ddimg='$ddimg'"
eval "${step}_ddimg_type='$img_type'"
test_url $img 'xz|gz'
eval "${step}_img='$img'"
eval "${step}_img_type='$img_type'"
}
setos_redhat() {
@ -250,7 +250,7 @@ if [ "$EUID" -ne 0 ]; then
exit 1
fi
if ! opts=$(getopt -a -n $0 --options l --long localtest,iso:,image-name:,ddimg: -- "$@"); then
if ! opts=$(getopt -a -n $0 --options l --long localtest,iso:,image-name:,img: -- "$@"); then
usage_and_exit
fi
@ -262,8 +262,8 @@ while true; do
confhome=$localtest_confhome
shift
;;
--ddimg)
ddimg=$2
--img)
img=$2
shift 2
;;
--iso)

View File

@ -91,7 +91,7 @@ if [ "$distro" = "alpine" ]; then
exec reboot
elif [ "$distro" = "dd" ]; then
case "$ddimg_type" in
case "$img_type" in
gz) prog=gzip ;;
xz) prog=xz ;;
esac
@ -99,7 +99,7 @@ elif [ "$distro" = "dd" ]; then
if [ -n "$prog" ]; then
# alpine busybox 自带 gzip xz但官方版也许性能更好
apk add curl $prog
curl -L $ddimg | $prog -dc >/dev/$xda
curl -L $img | $prog -dc >/dev/$xda
else
echo 'Not supported'
sleep 1m