core: 添加 --installer 参数

This commit is contained in:
bin456789 2024-09-03 19:01:32 +08:00
parent 1201e429b4
commit bcf90a68ff
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
2 changed files with 22 additions and 5 deletions

View File

@ -131,6 +131,10 @@ is_use_cloud_image() {
[ -n "$cloud_image" ] && [ "$cloud_image" = 1 ] [ -n "$cloud_image" ] && [ "$cloud_image" = 1 ]
} }
is_force_use_installer() {
[ -n "$installer" ] && [ "$installer" = 1 ]
}
is_use_dd() { is_use_dd() {
[ "$distro" = dd ] [ "$distro" = dd ]
} }
@ -2924,7 +2928,7 @@ else
fi fi
# 整理参数 # 整理参数
if ! opts=$(getopt -n $0 -o "" --long ci,debug,minimal,hold:,sleep:,iso:,image-name:,img:,lang:,commit:,force: -- "$@"); then if ! opts=$(getopt -n $0 -o "" --long ci,installer,debug,minimal,hold:,sleep:,iso:,image-name:,img:,lang:,commit:,force: -- "$@"); then
usage_and_exit usage_and_exit
fi fi
@ -2942,6 +2946,12 @@ while true; do
;; ;;
--ci) --ci)
cloud_image=1 cloud_image=1
unset installer
shift
;;
--installer)
installer=1
unset cloud_image
shift shift
;; ;;
--minimal) --minimal)
@ -3016,12 +3026,19 @@ case "$distro" in
dd | windows | netboot.xyz | kali | alpine | arch | gentoo | nixos) dd | windows | netboot.xyz | kali | alpine | arch | gentoo | nixos)
if is_use_cloud_image; then if is_use_cloud_image; then
echo "ignored --ci" echo "ignored --ci"
cloud_image=0 unset cloud_image
fi fi
;; ;;
redhat | centos | alma | rocky | oracle | ubuntu | fedora | opensuse | anolis | opencloudos | openeuler) oracle | opensuse | anolis | opencloudos | openeuler)
cloud_image=1 cloud_image=1
;; ;;
redhat | centos | alma | rocky | fedora | ubuntu)
if is_force_use_installer; then
unset cloud_image
else
cloud_image=1
fi
;;
esac esac
# 检查内存 # 检查内存

View File

@ -1866,8 +1866,8 @@ create_part() {
parted /dev/$xda -s -- \ parted /dev/$xda -s -- \
mklabel gpt \ mklabel gpt \
mkpart '" "' fat32 1MiB 1025MiB \ mkpart '" "' fat32 1MiB 1025MiB \
mkpart '" "' ext4 1025MiB -2GiB \ mkpart '" "' ext4 1025MiB -3GiB \
mkpart '" "' ext4 -2GiB 100% \ mkpart '" "' ext4 -3GiB 100% \
set 1 boot on set 1 boot on
update_part update_part