util-linux-ng: quote tests and some more variables

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2010-12-18 22:45:26 +01:00
parent e262e43f0f
commit b22c10e25b

View File

@ -31,8 +31,8 @@ INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
SWAP=`blkid -t TYPE="swap" -o device`
SWAPFILE="$HOME/.cache/swapfile"
if [ $INSTALLED_MEMORY -le 500000 ]; then
if [ -z "$SWAP" -a ! -f $SWAPFILE ]; then
if [ "$INSTALLED_MEMORY" -le "500000" ]; then
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
progress "creating swapfile"
mkdir -p $HOME/.cache
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
@ -40,12 +40,12 @@ if [ $INSTALLED_MEMORY -le 500000 ]; then
fi
progress "enable swap"
[ -z "$SWAP" -a -f $SWAPFILE ] && SWAP=$SWAPFILE
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
for i in $SWAP; do
swapon -p 10000 $SWAP 2>&1 > /dev/null
done
if [ $INSTALLED_MEMORY -le 260000 ]; then
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
sysctl -w vm.swappiness=100 2>&1 > /dev/null
else
sysctl -w vm.swappiness=60 2>&1 > /dev/null