fnos: 安装时不使用 installer 分区以降低硬盘大小要求

This commit is contained in:
bin456789 2025-03-03 07:16:45 +08:00
parent 1bd7f0a0f5
commit 066cad8c10
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B
4 changed files with 33 additions and 38 deletions

View File

@ -47,7 +47,7 @@ The system requirements for the target system are as follows:
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | Rolling | 512 MB | 5 GB | | <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | Rolling | 512 MB | 5 GB |
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | Rolling | 512 MB | 5 GB | | <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | Rolling | 512 MB | 5 GB |
| <img width="16" height="16" src="https://aosc.io/assets/distros/aosc-os.svg" /> AOSC OS | Rolling | 512 MB | 5 GB | | <img width="16" height="16" src="https://aosc.io/assets/distros/aosc-os.svg" /> AOSC OS | Rolling | 512 MB | 5 GB |
| <img width="16" height="16" src="https://www.fnnas.com/favicon.ico" /> fnOS | Beta | 512 MB | 12 GB | | <img width="16" height="16" src="https://www.fnnas.com/favicon.ico" /> fnOS | Beta | 512 MB | 8 GB |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Any | 512 MB | Depends on image | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | Any | 512 MB | Depends on image |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |

View File

@ -47,7 +47,7 @@
| <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | 滚动 | 512 MB | 5 GB | | <img width="16" height="16" src="https://archlinux.org/static/favicon.png" /> Arch | 滚动 | 512 MB | 5 GB |
| <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | 滚动 | 512 MB | 5 GB | | <img width="16" height="16" src="https://www.gentoo.org/assets/img/logo/gentoo-g.png" /> Gentoo | 滚动 | 512 MB | 5 GB |
| <img width="16" height="16" src="https://aosc.io/assets/distros/aosc-os.svg" /> 安同 OS | 滚动 | 512 MB | 5 GB | | <img width="16" height="16" src="https://aosc.io/assets/distros/aosc-os.svg" /> 安同 OS | 滚动 | 512 MB | 5 GB |
| <img width="16" height="16" src="https://www.fnnas.com/favicon.ico" /> 飞牛 fnOS | 公测 | 512 MB | 12 GB | | <img width="16" height="16" src="https://www.fnnas.com/favicon.ico" /> 飞牛 fnOS | 公测 | 512 MB | 8 GB |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | 任何 | 512 MB | 取决于镜像 | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (DD) | 任何 | 512 MB | 取决于镜像 |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
| <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB | | <img width="16" height="16" src="https://blogs.windows.com/wp-content/uploads/prod/2022/09/cropped-Windows11IconTransparent512-32x32.png" /> Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |

View File

@ -1502,7 +1502,8 @@ Continue with DD?
done done
iso=$(curl -L https://fnnas.com/ | grep -o 'https://[^"]*\.iso' | head -1) iso=$(curl -L https://fnnas.com/ | grep -o 'https://[^"]*\.iso' | head -1)
test_url "$iso" 'iso' # debian 9 下 iso 会被识别为 raw
test_url "$iso" 'iso raw'
eval "${step}_iso='$iso'" eval "${step}_iso='$iso'"
} }

View File

@ -2310,6 +2310,9 @@ create_part() {
mkfs.ntfs -f -F -L installer /dev/$xda*2 #2 installer mkfs.ntfs -f -F -L installer /dev/$xda*2 #2 installer
fi fi
elif [ "$distro" = fnos ]; then elif [ "$distro" = fnos ]; then
# 先用 100% 分区安装后再缩小没意义,因为小硬盘用 100% 还是装不了
# 因此直接用用户输入的分区大小
# 1. 官方安装器对系统盘大小的定义包含引导分区大小 # 1. 官方安装器对系统盘大小的定义包含引导分区大小
# 2. 官方用的是 100M 而不是 100MiB # 2. 官方用的是 100M 而不是 100MiB
if is_efi; then if is_efi; then
@ -2317,13 +2320,11 @@ create_part() {
mklabel gpt \ mklabel gpt \
mkpart BOOT fat32 1MiB 100M \ mkpart BOOT fat32 1MiB 100M \
mkpart SYSTEM ext4 100M ${fnos_part_size}iB \ mkpart SYSTEM ext4 100M ${fnos_part_size}iB \
mkpart TRIM ext4 ${fnos_part_size}iB 100% \
set 1 esp on set 1 esp on
update_part update_part
mkfs.fat /dev/$xda*1 #1 efi mkfs.fat /dev/$xda*1 #1 efi
echo #2 os 用目标系统的格式化工具 mkfs.ext4 -F /dev/$xda*2 #2 os + installer
mkfs.ext4 -F /dev/$xda*3 #3 installer
else else
# bios # bios
# 官方安装器不支持 bios + >2t # 官方安装器不支持 bios + >2t
@ -2331,13 +2332,11 @@ create_part() {
mklabel msdos \ mklabel msdos \
mkpart primary 1MiB 100M \ mkpart primary 1MiB 100M \
mkpart primary 100M ${fnos_part_size}iB \ mkpart primary 100M ${fnos_part_size}iB \
mkpart primary ${fnos_part_size}iB 100% \
set 2 boot on set 2 boot on
update_part update_part
echo #1 官方安装有这个分区 echo #1 官方安装有这个分区
echo #2 os 用目标系统的格式化工具 mkfs.ext4 -F /dev/$xda*2 #2 os + installer
mkfs.ext4 -F /dev/$xda*3 #3 installer
fi fi
elif is_use_cloud_image; then elif is_use_cloud_image; then
installer_part_size="$(get_cloud_image_part_size)" installer_part_size="$(get_cloud_image_part_size)"
@ -3862,15 +3861,18 @@ install_fnos() {
# 官方安装调用流程 # 官方安装调用流程
# /etc/init.d/run_install.sh > trim-install > trim-grub # /etc/init.d/run_install.sh > trim-install > trim-grub
# 挂载 installer iso # 挂载 /os
mkdir -p /installer /iso mkdir -p /os
mount /dev/$xda*3 /installer mount /dev/$xda*2 /os
download "$iso" /installer/fnos.iso
mount /installer/fnos.iso /iso # 下载并挂载 iso
mkdir -p /os/installer /iso
download "$iso" /os/installer/fnos.iso
mount -o ro /os/installer/fnos.iso /iso
# 解压 initrd # 解压 initrd
apk add cpio apk add cpio
initrd_dir=/installer/initrd_dir initrd_dir=/os/installer/initrd_dir
mkdir -p $initrd_dir mkdir -p $initrd_dir
( (
cd $initrd_dir cd $initrd_dir
@ -3878,25 +3880,18 @@ install_fnos() {
) )
apk del cpio apk del cpio
# 格式化系统盘
mount_pseudo_fs $initrd_dir
chroot $initrd_dir mkfs.ext4 /dev/$xda*2
umount_pseudo_fs $initrd_dir
# 获取挂载参数 # 获取挂载参数
fstab_line_os=$(strings $initrd_dir/trim-install | grep -m1 '^UUID=%s / ') fstab_line_os=$(strings $initrd_dir/trim-install | grep -m1 '^UUID=%s / ')
fstab_line_efi=$(strings $initrd_dir/trim-install | grep -m1 '^UUID=%s /boot/efi ') fstab_line_efi=$(strings $initrd_dir/trim-install | grep -m1 '^UUID=%s /boot/efi ')
fstab_line_swapfile=$(strings $initrd_dir/trim-install | grep -m1 '^/swapfile none swap ') fstab_line_swapfile=$(strings $initrd_dir/trim-install | grep -m1 '^/swapfile none swap ')
# 挂载 /os # 删除 initrd
mkdir -p /os rm -rf $initrd_dir
mount /dev/$xda*2 /os
# 复制系统 # 复制 trimfs.tgz 并删除 ISO 以获得更多空间
info "Extract fnos" cp /iso/trimfs.tgz /os/installer
apk add tar gzip pv umount /iso
pv -f /iso/trimfs.tgz | tar zxp --numeric-owner --xattrs-include='*.*' -C /os rm /os/installer/fnos.iso
apk del tar gzip pv
# 挂载 /os/boot/efi # 挂载 /os/boot/efi
if is_efi; then if is_efi; then
@ -3904,19 +3899,18 @@ install_fnos() {
mount -o "$(echo "$fstab_line_efi" | awk '{print $4}')" /dev/$xda*1 /os/boot/efi mount -o "$(echo "$fstab_line_efi" | awk '{print $4}')" /dev/$xda*1 /os/boot/efi
fi fi
# 复制系统
info "Extract fnos"
apk add tar gzip pv
pv -f /os/installer/trimfs.tgz | tar zxp --numeric-owner --xattrs-include='*.*' -C /os
apk del tar gzip pv
# 删除 installer (trimfs.tgz)
rm -rf /os/installer
# 挂载 proc sys dev # 挂载 proc sys dev
mount_pseudo_fs /os mount_pseudo_fs /os
# 卸载 iso installer
umount /iso
umount /installer
# 删除 installer 分区
apk add parted
parted -s /dev/$xda rm 3
apk del parted
update_part
# 更新 initrd # 更新 initrd
# chroot $os_dir update-initramfs -u # chroot $os_dir update-initramfs -u