The required BusyBox applets are enabled by default, so we can rely on them
being present in the system. This way, we make sure there are no conflicts
with less featured variants of these same applets which might also be
present in the system.
Fixes: 0bd7dfa3ed60 ("zram-swap: enable swap discard")
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
[wrap commit description]
Signed-off-by: David Bauer <mail@david-bauer.net>
include $(TOPDIR)/rules.mk
PKG_NAME:=zram-swap
include $(TOPDIR)/rules.mk
PKG_NAME:=zram-swap
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
define Package/zram-swap
SECTION:=utils
CATEGORY:=Base system
define Package/zram-swap
SECTION:=utils
CATEGORY:=Base system
- DEPENDS:=+kmod-zram +!(BUSYBOX_CONFIG_MKSWAP&&BUSYBOX_CONFIG_SWAPON&&BUSYBOX_CONFIG_SWAPOFF):swap-utils
+ DEPENDS:=+kmod-zram +@BUSYBOX_CONFIG_MKSWAP +@BUSYBOX_CONFIG_SWAPON +@BUSYBOX_CONFIG_FEATURE_SWAPON_DISCARD +@BUSYBOX_CONFIG_FEATURE_SWAPON_PRI +@BUSYBOX_CONFIG_SWAPOFF
TITLE:=ZRAM swap scripts
PKGARCH:=all
endef
TITLE:=ZRAM swap scripts
PKGARCH:=all
endef
- command -v mkswap >/dev/null || {
- logger -s -t zram_applicable -p daemon.err "[ERROR] 'mkswap' not installed"
+ [ -x /sbin/mkswap ] || {
+ logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox mkswap' not installed"
- command -v swapon >/dev/null || {
- logger -s -t zram_applicable -p daemon.err "[ERROR] 'swapon' not installed"
+ [ -x /sbin/swapon ] || {
+ logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapon' not installed"
- command -v swapoff >/dev/null || {
- logger -s -t zram_applicable -p daemon.err "[ERROR] 'swapoff' not installed"
+ [ -x /sbin/swapoff ] || {
+ logger -s -t zram_applicable -p daemon.err "[ERROR] 'BusyBox swapoff' not installed"
zram_comp_algo "$zram_dev"
zram_comp_streams "$zram_dev"
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
zram_comp_algo "$zram_dev"
zram_comp_streams "$zram_dev"
echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize"
- mkswap "$zram_dev"
- swapon -d $zram_priority "$zram_dev"
+ /sbin/mkswap "$zram_dev"
+ /sbin/swapon -d $zram_priority "$zram_dev"
for zram_dev in $( grep zram /proc/swaps |awk '{print $1}' ); do {
logger -s -t zram_stop -p daemon.debug "deactivate swap $zram_dev"
for zram_dev in $( grep zram /proc/swaps |awk '{print $1}' ); do {
logger -s -t zram_stop -p daemon.debug "deactivate swap $zram_dev"
- swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back"
+ /sbin/swapoff "$zram_dev" && zram_reset "$zram_dev" "claiming memory back"
local dev_index="$( echo $zram_dev | grep -o "[0-9]*$" )"
if [ $dev_index -ne 0 ]; then
logger -s -t zram_stop -p daemon.debug "removing zram $zram_dev"
local dev_index="$( echo $zram_dev | grep -o "[0-9]*$" )"
if [ $dev_index -ne 0 ]; then
logger -s -t zram_stop -p daemon.debug "removing zram $zram_dev"