mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-18 20:39:14 +08:00
dd: 参数 ddimg 改成 img
This commit is contained in:
parent
2e10b9390e
commit
ecc3134479
@ -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
|
||||
|
16
reinstall.sh
16
reinstall.sh
@ -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)
|
||||
|
4
trans.sh
4
trans.sh
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user