diff --git a/redhat.cfg b/redhat.cfg index 2ed8592..a53b0ea 100644 --- a/redhat.cfg +++ b/redhat.cfg @@ -49,19 +49,21 @@ done include=/tmp/include-packages-for-resize touch $include if [ -e /dev/disk/by-label/installer ]; then - # 1g内存下,安装器默认开启了zram ,但安装f38还是不够内存,所以还要开启swap - mkdir /installer - mount /dev/disk/by-label/installer /installer - mount /dev/disk/by-label/installer /installer -o remount,rw - swapfile=/installer/swapfile - if command -v fallocate; then - fallocate -l 1GiB $swapfile - else - dd if=/dev/zero of=$swapfile bs=1MiB count=1024 + # 1g内存下,安装器默认开启了zram ,但安装f38还是不够内存 + # 具体表现为不断重启安装界面,所以还要开启swap + ram_size=$(lsmem -b 2>/dev/null | grep 'Total online memory:' | awk '{ print $NF/1024/1024 }') + if [ -z $ram_size ] || [ $ram_size -le 1024 ]; then + mount /dev/disk/by-label/installer /run/install/repo -o remount,rw + swapfile=/run/install/repo/swapfile + if command -v fallocate; then + fallocate -l 1G $swapfile + else + dd if=/dev/zero of=$swapfile bs=1M count=1024 + fi + chmod 0600 $swapfile + mkswap $swapfile + swapon $swapfile fi - chmod 0600 $swapfile - mkswap $swapfile - swapon $swapfile # feroda 默认不包含 cronie echo cronie >>$include