aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/zram/zram/zram-swap-deinit
blob: 46248c401be1124eb237ca848b8a10a006b65e22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
set -e

device=$1
if [ "$device" = "" ]; then
    echo "Usage: zram-swap-deinit <device>"
    exit 1
fi

sysblockdev=/sys/block/$(basename $device)
if [ ! -d $sysblockdev ]; then
    echo "Block device not found in sysfs"
    exit 1
fi

# zramctl -r is not suitable as it also removes the actual device. Recreating
# it is non-trivial, especially if not /dev/zram0 is used...
echo 1 > ${sysblockdev}/reset