From cfd668c7eaab7bb5d982d9ef95d97b780213715a Mon Sep 17 00:00:00 2001 From: Weng Xuetian Date: Tue, 4 Nov 2014 20:51:48 +0000 Subject: [PATCH] fix zramswap --- zramswap/PKGBUILD | 6 +++--- zramswap/zram | 4 ---- zramswap/zram.service | 12 ------------ zramswap/zramstart | 20 -------------------- zramswap/zramstop | 13 ------------- 5 files changed, 3 insertions(+), 52 deletions(-) delete mode 100644 zramswap/zram delete mode 100755 zramswap/zram.service delete mode 100755 zramswap/zramstart delete mode 100755 zramswap/zramstop diff --git a/zramswap/PKGBUILD b/zramswap/PKGBUILD index 2666e3fdd..bedfe79f5 100644 --- a/zramswap/PKGBUILD +++ b/zramswap/PKGBUILD @@ -5,7 +5,7 @@ pkgname=zramswap pkgver=1.1 -pkgrel=1 +pkgrel=2 pkgdesc="Sets up zram swap devices on boot." arch=('any') url="http://en.wikipedia.org/wiki/ZRam" @@ -17,6 +17,6 @@ sha256sums=('f682f5199d72b38d37b7f92d84ce49bd9b1b3c7ff146507a08a3d602abde5f6f' '1d0a4ea2e48a3cd2aacdbfa5ddc4eea4abc43ad4fd3ff0e64cf40272f1adada6') package() { - install -Dm644 "${srcdir}/zramswap.service" "${pkgdir}/usr/lib/systemd/system/zramswap.service" - install -Dm644 "${srcdir}/zramctrl" "${pkgdir}/etc/default/zramctrl" + install -Dm755 zramctrl $pkgdir/usr/lib/systemd/scripts/zramctrl + install -Dm644 zramswap.service $pkgdir/usr/lib/systemd/system/zramswap.service } diff --git a/zramswap/zram b/zramswap/zram deleted file mode 100644 index 161d34953..000000000 --- a/zramswap/zram +++ /dev/null @@ -1,4 +0,0 @@ -# The factor is how much (from 0 to 100, percentage) -# of system RAM to allocate to ZRAM block devices -# Too big, and your system will start killing off processes -FACTOR=90 diff --git a/zramswap/zram.service b/zramswap/zram.service deleted file mode 100755 index a0e9ff9c4..000000000 --- a/zramswap/zram.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Enable compressed swap in memory using zram -After=multi-user.target - -[Service] -RemainAfterExit=yes -ExecStart=/usr/sbin/zramstart -ExecStop=/usr/sbin/zramstop -Type=oneshot - -[Install] -WantedBy=multi-user.target diff --git a/zramswap/zramstart b/zramswap/zramstart deleted file mode 100755 index c009cd846..000000000 --- a/zramswap/zramstart +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -num_cpus=$(grep -c processor /proc/cpuinfo) -[ "$num_cpus" != 0 ] || num_cpus=1 - -last_cpu=$((num_cpus - 1)) -FACTOR=90 -[ -f /etc/default/zram ] && source /etc/default/zram || true -factor=$FACTOR # percentage - -memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ') -mem_by_cpu=$(($memtotal/$num_cpus*$factor/100*1024)) - -modprobe -q zram num_devices=$num_cpus - -for i in $(seq 0 $last_cpu); do - echo $mem_by_cpu > /sys/block/zram$i/disksize - mkswap /dev/zram$i - swapon -p 100 /dev/zram$i -done diff --git a/zramswap/zramstop b/zramswap/zramstop deleted file mode 100755 index 5d4e04c72..000000000 --- a/zramswap/zramstop +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -num_cpus=$(grep -c processor /proc/cpuinfo) -[ "$num_cpus" != 0 ] || num_cpus=1 - -last_cpu=$((num_cpus - 1)) - -for i in $(seq 0 $last_cpu); do - grep -q "/dev/zram$i" /proc/swaps && swapoff /dev/zram$i -done - -sleep 1 -rmmod zram