diff --git a/README.md b/README.md index 2260a60..d740aa4 100644 --- a/README.md +++ b/README.md @@ -13,16 +13,10 @@ curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh && chm ``` sudo ./debi.sh --cdn --network-console --ethx --bbr --user root --password <这里设置 root 密码> ``` - -**❗ ARM 机器安装失败临时解决办法:添加以下参数(安装 5.10 新版内核)** -``` ---install 'ca-certificates libpam-systemd linux-image-5.10.0-0.bpo.7-arm64 flash-kernel' -``` - - +* ❗ **Oracle ARM 架构还需要添加 `--bpo-kernel` 参数,以安装新版 5.10 内核,否则系统可能无法启动** * 以上命令选项开启了 BBR;设置了网卡名称形式是 `eth0` 而不是 `ens3` 这种。 -* 如果是一般的 x86 架构 64 位机器(不是 ARM 架构的),还可以添加 `--cloud-kernel` 使用轻量版内核。 * 不加 `--password` 选项会提示输入密码。 +* (可选)添加 `--cloud-kernel` 参数,以安装空间占用较小的内核,但可能会导致 UEFI 启动的机器(如 Oracle、Azure 及 Hyper-V、Google Cloud 等)VNC 黑屏。BIOS 启动的普通 VPS 则没有此问题。 如果没有报错可以重启: @@ -124,7 +118,8 @@ Otherwise, you can run this command to revert all changes made by the script: * `--efi` Create an *EFI system partition*. Default if `/sys/firmware/efi` exists * `--filesystem ext4` * `--kernel ` Choose an package for the kernel image - * `--cloud-kernel` Choose `linux-image-cloud-amd64` as the kernel image + * `--cloud-kernel` Choose `linux-image-cloud-amd64` or `...arm64` as the kernel image + * `--bpo-kernel` Choose the kernel image from Debian Backports (newer version from the next Debian release) * `--no-install-recommends` * `--install 'ca-certificates libpam-systemd'` * `--safe-upgrade` **(Default)** `apt upgrade --with-new-pkgs`. [See](https://salsa.debian.org/installer-team/pkgsel/-/blob/master/debian/postinst) diff --git a/debi.sh b/debi.sh index 79c4fb8..977e659 100755 --- a/debi.sh +++ b/debi.sh @@ -98,6 +98,8 @@ force_gpt=true efi= filesystem=ext4 kernel= +cloud_kernel=false +bpo_kernel=false install_recommends=true install='ca-certificates libpam-systemd' upgrade= @@ -223,7 +225,10 @@ while [ $# -gt 0 ]; do shift ;; --cloud-kernel) - kernel=linux-image-cloud-amd64 + cloud_kernel=true + ;; + --bpo-kernel) + bpo_kernel=true ;; --no-install-recommends) install_recommends=false @@ -280,6 +285,42 @@ while [ $# -gt 0 ]; do shift done +if [ -z "$architecture" ]; then + architecture=$(dpkg --print-architecture 2> /dev/null) || + architecture=$(uname -m) + case $architecture in + x86_64) + architecture=amd64 + ;; + aarch64) + architecture=arm64 + ;; + i386) + : + ;; + *) + err 'No "--architecture" specified' + esac +fi + +if [ -z "$kernel" ]; then + if [ "$cloud_kernel" = true ]; then + if [ "$architecture" != amd64 ] && [ "$architecture" != arm64 ]; then + err 'Cloud kernel is only available for amd64 (x86_64) and arm64 (aarch64) architectures' + fi + kernel="linux-image-cloud-$architecture" + else + kernel="linux-image-$architecture" + fi + + if [ "$bpo_kernel" = true ]; then + if [ "$suite" = sid ] || [ "$suite" = unstable ]; then + err 'Backports kernel is not available for sid/unstable distribution' + fi + kernel="$kernel/$suite-backports" + fi +fi + if [ -n "$authorized_keys_url" ] && ! download "$authorized_keys_url" /dev/null; then err "Failed to download SSH authorized public keys from \"$authorized_keys_url\"" fi @@ -522,14 +563,14 @@ EOF fi -$save_preseed << 'EOF' +$save_preseed << EOF # Base system installation +d-i base-installer/kernel/image string $kernel EOF [ "$install_recommends" = false ] && echo "d-i base-installer/install-recommends boolean $install_recommends" | $save_preseed -[ -n "$kernel" ] && echo "d-i base-installer/kernel/image string $kernel" | $save_preseed [ "$security_repository" = mirror ] && security_repository=$mirror_protocol://$mirror_host${mirror_directory%/*}/debian-security @@ -579,11 +620,6 @@ EOF save_grub_cfg='cat' if [ "$dry_run" = false ]; then - if [ -z "$architecture" ]; then - architecture=amd64 - command_exists dpkg && architecture=$(dpkg --print-architecture) - fi - base_url="$mirror_protocol://$mirror_host$mirror_directory/dists/$suite/main/installer-$architecture/current/images/netboot/debian-installer/$architecture" firmware_url="https://cdimage.debian.org/cdimage/unofficial/non-free/firmware/$suite/current/firmware.cpio.gz"