From 85e6118ae30787b9f70e811ab42cd56ab3588697 Mon Sep 17 00:00:00 2001 From: Michael Kroes Date: Wed, 16 Mar 2016 12:54:19 +0100 Subject: [PATCH] Add extra comment about blocksizes. Inline if, to check if swap was mounted --- setup/system.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/setup/system.sh b/setup/system.sh index 7904b1f6..93086322 100755 --- a/setup/system.sh +++ b/setup/system.sh @@ -41,7 +41,8 @@ if then echo "Adding swap to the system..." - # Allocate and activate the swap file + # Allocate and activate the swap file. Allocate in 1KB chuncks + # doing it in one go, could fail on low memory systems dd if=/dev/zero of=/swapfile bs=1024 count=$[1024*1024] status=none if [ -e /swapfile ]; then chmod 600 /swapfile @@ -50,7 +51,7 @@ then fi # Check if swap is mounted then activate on boot - if [ -n "$(swapon -s | grep "\/swapfile")" ]; then + if swapon -s | grep -q "\/swapfile"; then echo "/swapfile none swap sw 0 0" >> /etc/fstab else echo "ERROR: Swap allocation failed"