Brad Bishop | 63ae878 | 2019-10-09 09:56:13 -0400 | [diff] [blame^] | 1 | #!/bin/sh |
2 | set -e | ||||
3 | |||||
4 | device=$1 | ||||
5 | if [ "$device" = "" ]; then | ||||
6 | echo "Usage: zram-swap-deinit <device>" | ||||
7 | exit 1 | ||||
8 | fi | ||||
9 | |||||
10 | sysblockdev=/sys/block/$(basename $device) | ||||
11 | if [ ! -d $sysblockdev ]; then | ||||
12 | echo "Block device not found in sysfs" | ||||
13 | exit 1 | ||||
14 | fi | ||||
15 | |||||
16 | # zramctl -r is not suitable as it also removes the actual device. Recreating | ||||
17 | # it is non-trivial, especially if not /dev/zram0 is used... | ||||
18 | echo 1 > ${sysblockdev}/reset | ||||
19 |