diff --git a/zram.sh b/zram.sh index 6a054978..088a7152 100755 --- a/zram.sh +++ b/zram.sh @@ -1,13 +1,13 @@ #!/bin/bash DEVICE=/dev/zram0 -SIZE=1G +${ZRAM_SIZE:=1G} CURRENT_SIZE=$(zramctl --raw --noheadings --output DISKSIZE $DEVICE) -if [ $CURRENT_SIZE != $SIZE ]; then +if [ $CURRENT_SIZE != $ZRAM_SIZE ]; then swapoff $DEVICE - zramctl $DEVICE --algorithm lz4 --size $SIZE + zramctl $DEVICE --algorithm lz4 --size $ZRAM_SIZE mkswap $DEVICE swapon $DEVICE fi