aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Salvaterra <rsalvaterra@gmail.com>2021-04-01 14:36:33 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2021-04-18 12:05:53 +0200
commitab610f5af30bbdd937f4e8d93bb718b25b589d00 (patch)
tree6e24a1550520967ae101b197fdec6a1a99f51159
parent8bbf5bc4b0f27d6f71b5746da8579390ff9be9e4 (diff)
downloadupstream-ab610f5af30bbdd937f4e8d93bb718b25b589d00.tar.gz
upstream-ab610f5af30bbdd937f4e8d93bb718b25b589d00.tar.bz2
upstream-ab610f5af30bbdd937f4e8d93bb718b25b589d00.zip
zram-swap: bail out early if the kernel doesn't support swap
Since KERNEL_SWAP is only enabled by default for !SMALL_FLASH targets, we need to check if the current kernel supports swap before trying to configure zram-swap, as opkg can't check for kernel dependencies. Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com> (cherry picked from commit 565dfeb1280343fb3f838581169e5d7a1c947862)
-rwxr-xr-xpackage/system/zram-swap/files/zram.init5
1 files changed, 5 insertions, 0 deletions
diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init
index 685648aae5..d97e85efa5 100755
--- a/package/system/zram-swap/files/zram.init
+++ b/package/system/zram-swap/files/zram.init
@@ -150,6 +150,11 @@ zram_compact()
start()
{
+ [ -e /proc/swaps ] || {
+ logger -s -t zram_start -p daemon.crit "kernel doesn't support swap"
+ return 1
+ }
+
if [ $( grep -cs zram /proc/swaps ) -ne 0 ]; then
logger -s -t zram_start -p daemon.notice "[OK] zram swap is already mounted"
return 1