armbian-install: limit automated swap creation to 16Gb (#4528)

This commit is contained in:
Igor Pečovnik
2022-12-06 09:47:30 +01:00
committed by GitHub
parent d66e8205ed
commit 854834e166

View File

@@ -360,6 +360,13 @@ create_armbian()
if [[ $2 == ${DISK_ROOT_PART} && -z $1 && $DEVICE_TYPE = uefi ]]; then
# create swap file size of your memory so we can use it for S4
MEM_TOTAL=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}')
# but no more then 16Gb
[[ ${MEM_TOTAL} -gt 16107868 ]] && MEM_TOTAL=16107868
dd if=/dev/zero of="${TempDir}"/rootfs/swapfile bs=${MEM_TOTAL} count=1024 conv=notrunc
# create swap file size of your memory so we can use it for S4
dd if=/dev/zero of="${TempDir}"/rootfs/swapfile bs=$(cat /proc/meminfo | awk '/MemTotal/ {print $2}') count=1024 conv=notrunc
mkswap "${TempDir}"/rootfs/swapfile