mirror of
https://github.com/bin456789/reinstall.git
synced 2025-01-19 04:49:13 +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'
|
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:
|
dd:
|
||||||
bash reinstall.sh dd --ddimg=https://example.com/xxx.gz
|
bash reinstall.sh dd --img=https://example.com/xxx.gz
|
||||||
|
|
||||||
重启:
|
重启:
|
||||||
reboot
|
reboot
|
||||||
|
16
reinstall.sh
16
reinstall.sh
@ -128,13 +128,13 @@ setos() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setos_dd() {
|
setos_dd() {
|
||||||
if [ -z "$ddimg" ]; then
|
if [ -z "$img" ]; then
|
||||||
echo "dd need --ddimg"
|
echo "dd need --img"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
test_url $ddimg 'xz|gz'
|
test_url $img 'xz|gz'
|
||||||
eval "${step}_ddimg='$ddimg'"
|
eval "${step}_img='$img'"
|
||||||
eval "${step}_ddimg_type='$img_type'"
|
eval "${step}_img_type='$img_type'"
|
||||||
}
|
}
|
||||||
|
|
||||||
setos_redhat() {
|
setos_redhat() {
|
||||||
@ -250,7 +250,7 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
usage_and_exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -262,8 +262,8 @@ while true; do
|
|||||||
confhome=$localtest_confhome
|
confhome=$localtest_confhome
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--ddimg)
|
--img)
|
||||||
ddimg=$2
|
img=$2
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--iso)
|
--iso)
|
||||||
|
4
trans.sh
4
trans.sh
@ -91,7 +91,7 @@ if [ "$distro" = "alpine" ]; then
|
|||||||
exec reboot
|
exec reboot
|
||||||
|
|
||||||
elif [ "$distro" = "dd" ]; then
|
elif [ "$distro" = "dd" ]; then
|
||||||
case "$ddimg_type" in
|
case "$img_type" in
|
||||||
gz) prog=gzip ;;
|
gz) prog=gzip ;;
|
||||||
xz) prog=xz ;;
|
xz) prog=xz ;;
|
||||||
esac
|
esac
|
||||||
@ -99,7 +99,7 @@ elif [ "$distro" = "dd" ]; then
|
|||||||
if [ -n "$prog" ]; then
|
if [ -n "$prog" ]; then
|
||||||
# alpine busybox 自带 gzip xz,但官方版也许性能更好
|
# alpine busybox 自带 gzip xz,但官方版也许性能更好
|
||||||
apk add curl $prog
|
apk add curl $prog
|
||||||
curl -L $ddimg | $prog -dc >/dev/$xda
|
curl -L $img | $prog -dc >/dev/$xda
|
||||||
else
|
else
|
||||||
echo 'Not supported'
|
echo 'Not supported'
|
||||||
sleep 1m
|
sleep 1m
|
||||||
|
Loading…
x
Reference in New Issue
Block a user