diff --git a/reinstall.sh b/reinstall.sh index ce6cabe..2ee7aa3 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -673,7 +673,7 @@ check_ram() { fi case "$distro" in - alpine) ram_installer=0 ;; # 未测试 + alpine) ram_installer=256 ;; # 192 无法启动 netboot debian) ram_installer=384 ;; *) ram_installer=1024 ;; esac diff --git a/trans.sh b/trans.sh index 78a5432..e040a65 100644 --- a/trans.sh +++ b/trans.sh @@ -290,6 +290,44 @@ insert_into_file() { } install_alpine() { + hack_lowram=true + if $hack_lowram; then + # 预先加载需要的模块 + if rc-service modloop status; then + modules="ext4 vfat nls_utf8 nls_cp437 crc32c" + for mod in $modules; do + modprobe $mod + done + fi + + # 删除 modloop ,释放内存 + rc-service modloop stop + rm -f /lib/modloop-lts /lib/modloop-virt + + # 复制一份原版,防止再次运行时出错 + if [ -e /sbin/setup-disk.orig ]; then + cp -f /sbin/setup-disk.orig /sbin/setup-disk + else + cp -f /sbin/setup-disk /sbin/setup-disk.orig + fi + + # 格式化系统分区、mount 后立即开启 swap + # shellcheck disable=SC2016 + insert_into_file /sbin/setup-disk after 'mount -t \$ROOTFS \$root_dev "\$SYSROOT"' <>/mnt/etc/fstab +EOF + fi + # 网络 # 坑1 udhcpc下,ip -4 addr 无法知道是否是 dhcp # 坑2 udhcpc不支持dhcpv6