No swap on devices with 4GB+ RAM

This commit is contained in:
Taylor Helsper 2020-05-11 19:50:50 -05:00
parent 9320d4c54e
commit c2d218d19b
2 changed files with 6 additions and 2 deletions

View File

@ -331,8 +331,11 @@ if [ $IS_RASPI -eq 1 ] || [ $IS_ROCKPRO64 -eq 1 ]; then
dd if=/dev/zero of=/mnt/hdd/swapfile count=1000 bs=1MiB
chmod 600 /mnt/hdd/swapfile
fi
mkswap /mnt/hdd/swapfile
dphys-swapfile swapon
# Only setup swap for low-mem devices
if [ "$TOTAL_RAM_GB" -lt "4" ]; then
mkswap /mnt/hdd/swapfile
dphys-swapfile swapon
fi
fi

View File

@ -37,6 +37,7 @@ elif [ $IS_X86 -eq 1 ]; then
DEVICE_TYPE="debian"
fi
TOTAL_RAM_GB=$(free --giga | grep Mem | awk '{print $2}')
SERIAL_NUM=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)
if [[ "$SERIAL_NUM" == "" ]]; then