From f53f45b41f5d2565f83afff638a8f6d144968487 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 31 Mar 2024 01:07:33 +0800 Subject: [PATCH] =?UTF-8?q?debian:=20=E5=B0=9D=E8=AF=95=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20256M=20=E5=86=85=E5=AD=98=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian.cfg | 2 +- reinstall.sh | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/debian.cfg b/debian.cfg index 2dbca01..5dcd4e2 100644 --- a/debian.cfg +++ b/debian.cfg @@ -107,7 +107,7 @@ d-i partman/early_command string \ anna-install fdisk-udeb; \ cp $postinst $postinst.orig; \ - echo "fallocate -l 256M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \ + echo "fallocate -l 384M $swapfile; mkswap $swapfile; swapon $swapfile; $postinst.orig" >$postinst; \ echo "swapoff $swapfile; rm $swapfile" >/usr/lib/finish-install.d/95swapoff; \ chmod a+x /usr/lib/finish-install.d/95swapoff; \ diff --git a/reinstall.sh b/reinstall.sh index 6d466c8..4dcd95e 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -835,8 +835,7 @@ check_ram() { ram_standard=$( case "$distro" in netboot.xyz) echo 0 ;; - alpine | dd) echo 256 ;; # 192 无法启动 netboot - debian) echo 384 ;; + alpine | debian | dd) echo 256 ;; arch | gentoo | windows) echo 512 ;; centos | alma | rocky | fedora | ubuntu) echo 1024 ;; opensuse) echo max ;; # 没有安装模式 @@ -1504,6 +1503,9 @@ EOF sed "s|@mac_addr|$mac_addr|" | sed "s|@netconf|$netconf|" >var/lib/dpkg/info/netcfg.postinst + # 将 use_level 2 9 修改为 use_level 1 + sed -i 's/use_level=[29]/use_level=1/' lib/debian-installer-startup.d/S15lowmem + # hack 3 # 修改 trans.sh # 1. 直接调用 create_ifupdown_config @@ -1663,6 +1665,40 @@ mod_initrd() { mod_initrd_$nextos_distro + # 删除 initrd 里面没用的文件/驱动 + if is_virt && ! is_alpine_live; then + rm -rf bin/brltty + rm -rf etc/brltty + rm -rf sbin/wpa_supplicant + rm -rf usr/lib/libasound.so.* + ( + cd lib/modules/*/kernel/drivers/net/ethernet/ + for item in *; do + case "$item" in + intel | amazon | google) ;; + *) rm -rf $item ;; + esac + done + ) + ( + cd lib/modules/*/kernel + for item in \ + drivers/mmc \ + drivers/net/bonding \ + drivers/net/usb \ + drivers/net/wireless \ + drivers/pcmcia \ + drivers/staging \ + drivers/usb/serial \ + drivers/usb/storage \ + net/bluetooth \ + net/mac80211 \ + net/wireless; do + rm -rf $item + done + ) + fi + # 重建 # 注意要用 cpio -H newc 不要用 cpio -c ,不同版本的 -c 作用不一样,很坑 # -c Use the old portable (ASCII) archive format