diff --git a/README.en.md b/README.en.md
index 535dd68..1f22d74 100644
--- a/README.en.md
+++ b/README.en.md
@@ -15,7 +15,7 @@ One-Click Script to Reinstall System [中文](README.md)
## Highlights
-- One-click Linux installation: Supports 17 common distributions.
+- One-click Linux installation: Supports 18 common distributions.
- One-click Windows installation: Uses the official ISO for installation instead of custom images. The script automatically retrieves the ISO link and installs `Virtio` and other drivers.
- Supports installation in any direction, i.e., `Linux to Linux`, `Linux to Windows`, `Windows to Windows`, `Windows to Linux`
- No need to input IP parameters; automatically recognizes dynamic and static IPs, supports `/32`, `/128`, `gateway outside subnet`, `IPv6 only`, `dual NIC` and other special network configurations
@@ -31,7 +31,7 @@ The original system can be any system listed in the table.
The system requirements for the target system are as follows:
-| Target System | Version | Memory | Disk |
+| System | Version | Memory | Disk |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | -----------------|
|
Alpine | 3.18, 3.19, 3.20, 3.21 | 256 MB | 1 GB |
|
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
@@ -47,6 +47,7 @@ The system requirements for the target system are as follows:
|
NixOS | 24.11 | 512 MB | 5 GB |
|
Arch | Rolling | 512 MB | 5 GB |
|
Gentoo | Rolling | 512 MB | 5 GB |
+|
飞牛 fnOS | Beta | 512 MB | 12 GB |
|
Windows (DD) | Any | 512 MB | Depends on image |
|
Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
|
Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |
@@ -141,6 +142,7 @@ bash reinstall.sh anolis 7|8|23
kali
arch
gentoo
+ fnos
```
#### Optional Parameters
diff --git a/README.md b/README.md
index d99a331..0c7b53d 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
## 亮点
-- 一键安装 Linux,支持 17 种常见发行版
+- 一键安装 Linux,支持 18 种常见发行版
- 一键安装 Windows,使用官方 ISO 安装而非自制镜像,脚本会自动获取 ISO 链接、自动安装 Virtio 等驱动
- 支持任意方向重装,即 `Linux to Linux`、`Linux to Windows`、`Windows to Windows`、`Windows to Linux`
- 无需填写 IP 参数,自动识别动静态,支持 `/32`、`/128`、`网关不在子网范围内`、`纯 IPv6`、`双网卡` 等特殊网络
@@ -31,7 +31,7 @@
目标系统的配置要求如下:
-| 目标系统 | 版本 | 内存 | 硬盘 |
+| 系统 | 版本 | 内存 | 硬盘 |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ------------ |
|
Alpine | 3.18, 3.19, 3.20, 3.21 | 256 MB | 1 GB |
|
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
@@ -47,6 +47,7 @@
|
NixOS | 24.11 | 512 MB | 5 GB |
|
Arch | 滚动 | 512 MB | 5 GB |
|
Gentoo | 滚动 | 512 MB | 5 GB |
+|
飞牛 fnOS | 公测版 | 512 MB | 12 GB |
|
Windows (DD) | 任何 | 512 MB | 取决于镜像 |
|
Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
|
Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |
@@ -141,6 +142,7 @@ bash reinstall.sh anolis 7|8|23
kali
arch
gentoo
+ fnos
```
#### 可选参数
diff --git a/reinstall.sh b/reinstall.sh
index f1eb8e6..fcdbe11 100644
--- a/reinstall.sh
+++ b/reinstall.sh
@@ -62,6 +62,7 @@ Usage: $reinstall_____ anolis 7|8|23
kali
arch
gentoo
+ fnos
dd --img='http://xxx.com/yyy.zzz' (raw image stores in raw/vhd/tar/gz/xz/zst)
windows --image-name='windows xxx yyy' --lang=xx-yy
windows --image-name='windows xxx yyy' --iso='http://xxx.com/xxx.iso'
@@ -1454,6 +1455,30 @@ Continue with DD?
eval "${step}_img_type_warp='$img_type_warp'"
}
+ setos_fnos() {
+ if [ "$basearch" = aarch64 ]; then
+ error_and_exit "FNOS not supports ARM."
+ fi
+
+ # 系统盘大小
+ min=8
+ default=8
+ while true; do
+ IFS= read -r -p "Type System Partition Size in GB. Minimal $min GB. [$default]: " input
+ input=${input:-$default}
+ if ! { is_digit "$input" && [ "$input" -ge "$min" ]; }; then
+ error "Invalid Size. Please Try again."
+ else
+ eval "${step}_fnos_part_size=${input}G"
+ break
+ fi
+ done
+
+ iso=$(curl -L https://fnnas.com | grep -o 'https://[^"]*\.iso' | head -1)
+ test_url "$iso" 'iso'
+ eval "${step}_iso='$iso'"
+ }
+
setos_centos_almalinux_rocky_fedora() {
# el 10 需要 x86-64-v3
if [ "$basearch" = x86_64 ] &&
@@ -1694,6 +1719,7 @@ verify_os_name() {
'kali' \
'arch' \
'gentoo' \
+ 'fnos' \
'windows' \
'dd' \
'netboot.xyz'; do
@@ -1952,7 +1978,7 @@ check_ram() {
alpine | debian | kali | dd) echo 256 ;;
arch | gentoo | nixos | windows) echo 512 ;;
redhat | centos | almalinux | rocky | fedora | oracle | ubuntu | anolis | opencloudos | openeuler) echo 1024 ;;
- opensuse) echo -1 ;; # 没有安装模式
+ opensuse | fnos) echo -1 ;; # 没有安装模式
esac
)
@@ -3701,15 +3727,14 @@ fi
# 密码
if ! is_netboot_xyz && [ -z "$password" ]; then
- if is_use_dd; then
+ if is_use_dd || [ "$distro" = fnos ]; then
echo "
-This password is only used for SSH access to view logs during the DD process.
+This password is only used for SSH access to view logs during the installation.
Password of the image will NOT modify.
-密码仅用于 DD 过程中通过 SSH 查看日志。
+密码仅用于安装过程中通过 SSH 查看日志。
镜像的密码不会被修改。
"
-
fi
prompt_password
fi
@@ -4140,7 +4165,7 @@ fi
info 'info'
echo "$distro $releasever"
-if ! { is_netboot_xyz || is_use_dd; }; then
+if ! { is_netboot_xyz || is_use_dd || [ "$distro" = fnos ]; }; then
if [ "$distro" = windows ]; then
username="administrator"
else
@@ -4156,6 +4181,9 @@ elif is_alpine_live; then
echo 'Reboot to start Alpine Live OS.'
elif is_use_dd; then
echo 'Reboot to start DD.'
+elif [ "$distro" = fnos ]; then
+ echo "Reboot to start the installation."
+ echo "After install, you need to config the system on http://SERVER_IP:5666 as soon as possible."
else
echo "Reboot to start the installation."
fi
diff --git a/trans.sh b/trans.sh
index c354a4f..3de036d 100644
--- a/trans.sh
+++ b/trans.sh
@@ -2229,6 +2229,36 @@ create_part() {
mkfs.ntfs -f -F -L os /dev/$xda*1 #1 os
mkfs.ntfs -f -F -L installer /dev/$xda*2 #2 installer
fi
+ elif [ "$distro" = fnos ]; then
+ # 1. 官方安装器对系统盘大小的定义包含引导分区大小
+ # 2. 官方用的是 100M 而不是 100MiB
+ if is_efi; then
+ parted /dev/$xda -s -- \
+ mklabel gpt \
+ mkpart BOOT fat32 1MiB 100M \
+ mkpart SYSTEM ext4 100M ${fnos_part_size}iB \
+ mkpart TRIM ext4 ${fnos_part_size}iB 100% \
+ set 1 esp on
+ update_part
+
+ mkfs.fat /dev/$xda*1 #1 efi
+ echo #2 os 用目标系统的格式化工具
+ mkfs.ext4 -F /dev/$xda*3 #3 installer
+ else
+ # bios
+ # 官方安装器不支持 bios + >2t
+ parted /dev/$xda -s -- \
+ mklabel msdos \
+ mkpart primary 1MiB 100M \
+ mkpart primary 100M ${fnos_part_size}iB \
+ mkpart primary ${fnos_part_size}iB 100% \
+ set 2 boot on
+ update_part
+
+ echo #1 官方安装有这个分区
+ echo #2 os 用目标系统的格式化工具
+ mkfs.ext4 -F /dev/$xda*3 #3 installer
+ fi
elif is_use_cloud_image; then
installer_part_size="$(get_cloud_image_part_size)"
# 这几个系统不使用dd,而是复制文件
@@ -2383,9 +2413,24 @@ create_part() {
fi
}
+umount_pseudo_fs() {
+ os_dir=$(realpath "$1")
+
+ dirs="/proc /sys /dev /run /sys/firmware/efi/efivars"
+ regex=$(echo "$dirs" | sed 's, ,|,g')
+ if mounts=$(mount | grep -Ew "on $os_dir($regex)" | awk '{print $3}' | tac); then
+ for mount in $mounts; do
+ echo "umount $mount"
+ umount $mount
+ done
+ fi
+}
+
mount_pseudo_fs() {
os_dir=$1
+ mkdir -p $os_dir/proc/ $os_dir/sys/ $os_dir/dev/ $os_dir/run/
+
# https://wiki.archlinux.org/title/Chroot#Using_chroot
mount -t proc /proc $os_dir/proc/
mount -t sysfs /sys $os_dir/sys/
@@ -3716,6 +3761,120 @@ EOF
fi
}
+install_fnos() {
+ info "Install fnos"
+ os_dir=/os
+
+ # 官方安装调用流程
+ # /etc/init.d/run_install.sh > trim-install > trim-grub
+
+ # 挂载 installer iso
+ mkdir -p /installer /iso
+ mount /dev/$xda*3 /installer
+ download "$iso" /installer/fnos.iso
+ mount /installer/fnos.iso /iso
+
+ # 解压 initrd
+ apk add cpio
+ initrd_dir=/installer/initrd_dir
+ mkdir -p $initrd_dir
+ (
+ cd $initrd_dir
+ zcat /iso/install.amd/initrd.gz | cpio -idm
+ )
+ 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_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 ')
+
+ # 挂载 /os
+ mkdir -p /os
+ mount /dev/$xda*2 /os
+
+ # 复制系统
+ info "Extract fnos"
+ apk add tar gzip pv
+ pv -f /iso/trimfs.tgz | tar zx -C /os --numeric-owner
+ apk del tar gzip pv
+
+ # 挂载 /os/boot/efi
+ if is_efi; then
+ mkdir -p /os/boot/efi
+ mount -o "$(echo "$fstab_line_efi" | awk '{print $4}')" /dev/$xda*1 /os/boot/efi
+ fi
+
+ # 挂载 proc sys dev
+ 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
+ # chroot $os_dir update-initramfs -u
+
+ # 删除自带的 root 密码
+ # chroot $os_dir passwd -d root
+
+ # ssh root 登录,测试用
+ if false; then
+ echo "root:$(get_password_linux_sha512)" | chroot $os_dir chpasswd -e
+ allow_root_password_login $os_dir
+ chroot $os_dir systemctl enable ssh
+ fi
+
+ # grub
+ if is_efi; then
+ chroot $os_dir grub-install --efi-directory=/boot/efi
+ chroot $os_dir grub-install --efi-directory=/boot/efi --removable
+ else
+ chroot $os_dir grub-install /dev/$xda
+ fi
+
+ # grub tty
+ ttys_cmdline=$(get_ttys console=)
+ echo GRUB_CMDLINE_LINUX=\"\$GRUB_CMDLINE_LINUX $ttys_cmdline\" \
+ >>$os_dir/etc/default/grub.d/tty.cfg
+ chroot $os_dir update-grub
+
+ # fstab
+ {
+ # /
+ uuid=$(lsblk /dev/$xda*2 -no UUID)
+ echo "$fstab_line_os" | sed "s/%s/$uuid/"
+
+ # 官方安装器即使 swapfile 设为 0 也会有这行
+ echo "$fstab_line_swapfile" | sed "s/%s/$uuid/"
+
+ # /boot/efi
+ if is_efi; then
+ uuid=$(lsblk /dev/$xda*1 -no UUID)
+ echo "$fstab_line_efi" | sed "s/%s/$uuid/"
+ fi
+ } >$os_dir/etc/fstab
+
+ # 网卡配置
+ create_cloud_init_network_config /net.cfg
+ create_network_manager_config /net.cfg $os_dir
+ rm /net.cfg
+
+ # 修正网卡名
+ add_fix_eth_name_systemd_service $os_dir
+}
+
install_qcow_by_copy() {
info "Install qcow2 by copy"
@@ -5900,6 +6059,10 @@ trans() {
create_part
install_nixos
;;
+ fnos)
+ create_part
+ install_fnos
+ ;;
*)
create_part
mount_part_for_iso_installer