aboutsummaryrefslogtreecommitdiffstats
path: root/package/system/zram-swap
diff options
context:
space:
mode:
authorSamuel Casa <samuel.casa@neratec.com>2018-08-07 11:16:34 +0200
committerJo-Philipp Wich <jo@mein.io>2018-12-18 17:22:04 +0100
commitafd6460418dfbe9ed370a4f9ce4a8fb202f4eb7d (patch)
tree56a55c8de482e180ce6f4afe8f8a5fcc50e4ccad /package/system/zram-swap
parentac7c30708f8be29016bae7490d32405713083fd5 (diff)
downloadupstream-afd6460418dfbe9ed370a4f9ce4a8fb202f4eb7d.tar.gz
upstream-afd6460418dfbe9ed370a4f9ce4a8fb202f4eb7d.tar.bz2
upstream-afd6460418dfbe9ed370a4f9ce4a8fb202f4eb7d.zip
zram-swap: Shell cosmetic
Signed-off-by: Samuel Casa <samuel.casa@neratec.com> (backported from 65e9561b3d0546bfe6bad1840d81c0aa07b0c68d)
Diffstat (limited to 'package/system/zram-swap')
-rw-r--r--package/system/zram-swap/files/zram.init8
1 files changed, 4 insertions, 4 deletions
diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 17483c8fbc..63a20479d1 100644
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -16,7 +16,7 @@ zram_size() # in megabytes
if [ -z "$zram_size" ]; then
# e.g. 6mb for 16mb-routers or 61mb for 128mb-routers
- echo $(( $ram_size / 2048 ))
+ echo $(( ram_size / 2048 ))
else
echo "$zram_size"
fi
@@ -72,7 +72,7 @@ zram_reset()
list_cpu_idx()
{
# Offset by 1 if /dev/zram0 is in use by /tmp
- if [ "$(mount | grep /dev/zram0)" ]; then
+ if mount | grep -q /dev/zram0; then
local line i=1
# Hot-add new ZRAM device (if necessary)
if [ ! -b /dev/zram1 ]; then
@@ -86,7 +86,7 @@ list_cpu_idx()
case "$line" in
[Pp]rocessor*)
echo $i
- i=$(( $i + 1 ))
+ i=$(( i + 1 ))
;;
esac
} done <"/proc/cpuinfo"
@@ -107,7 +107,7 @@ start()
logger -s -t zram_start -p daemon.debug "activating '$zram_dev' for swapping ($zram_size MegaBytes)"
zram_reset "$zram_dev" "enforcing defaults"
- echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename $zram_dev )/disksize"
+ echo $(( zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
mkswap "$zram_dev"
swapon "$zram_dev"
} done