mirror of
https://github.com/outbackdingo/ports.git
synced 2026-01-27 10:20:12 +00:00
new-port venom-zram-0.1
This commit is contained in:
5
main/venom-zram/.checksums
Normal file
5
main/venom-zram/.checksums
Normal file
@@ -0,0 +1,5 @@
|
||||
82cb6a55b9df9c192bee81b4b5d6516f finish.zramd
|
||||
7689d3fcbc7780e7d9b39c0f7be462b2 rc.zramd
|
||||
f4ff43043c8c6b1665b3566602382aae run.zramd
|
||||
06bdfba41f6a66adb7a0670a2372bf19 venom-zram
|
||||
cf416b521356b90db26aa99f94e55fa8 venom-zram.conf
|
||||
8
main/venom-zram/.pkgfiles
Normal file
8
main/venom-zram/.pkgfiles
Normal file
@@ -0,0 +1,8 @@
|
||||
venom-zram-0.1-1
|
||||
drwxr-xr-x root/root etc/
|
||||
drwxr-xr-x root/root etc/rc.d/
|
||||
-rwxr-xr-x root/root etc/rc.d/zramd
|
||||
-rw-r--r-- root/root etc/venom-zram.conf
|
||||
drwxr-xr-x root/root usr/
|
||||
drwxr-xr-x root/root usr/bin/
|
||||
-rwxr-xr-x root/root usr/bin/venom-zram
|
||||
2
main/venom-zram/finish.zramd
Executable file
2
main/venom-zram/finish.zramd
Executable file
@@ -0,0 +1,2 @@
|
||||
#! /bin/sh
|
||||
venom-zram toss
|
||||
34
main/venom-zram/rc.zramd
Executable file
34
main/venom-zram/rc.zramd
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# /etc/rc.d/zramd: start/stop Zram Service
|
||||
#
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
NAME="Zramd"
|
||||
PROG="/usr/bin/venom-zram"
|
||||
|
||||
case $1 in
|
||||
start)
|
||||
msg "Starting $NAME..."
|
||||
$PROG make
|
||||
;;
|
||||
stop)
|
||||
msg "Stopping $NAME..."
|
||||
$PROG toss
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
[ -z "$( awk 'NR==2 {print $1}' /proc/swaps)" ] && \
|
||||
msg "$NAME is running\n" || msg "$NAME is not running\n"
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 [start|stop|restart|status]"
|
||||
;;
|
||||
esac
|
||||
|
||||
# End of file
|
||||
3
main/venom-zram/run.zramd
Executable file
3
main/venom-zram/run.zramd
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
[ -r /etc/venom-zram.conf ] && . /etc/venom-zram.conf
|
||||
venom-zram make &
|
||||
25
main/venom-zram/spkgbuild
Normal file
25
main/venom-zram/spkgbuild
Normal file
@@ -0,0 +1,25 @@
|
||||
# description : Manage zram space
|
||||
# depends : util-linux lz4
|
||||
# optional : zstd
|
||||
|
||||
name=venom-zram
|
||||
version=0.1
|
||||
release=1
|
||||
source="venom-zram venom-zram.conf rc.zramd run.zramd finish.zramd"
|
||||
|
||||
build() {
|
||||
|
||||
install -Dm755 venom-zram -t $PKG/usr/bin/
|
||||
install -Dm644 venom-zram.conf -t $PKG/etc/
|
||||
_runit() {
|
||||
install -Dm755 run.zramd $PKG/etc/sv/zramd/run
|
||||
install -Dm755 finish.zramd $PKG/etc/sv/zramd/finish
|
||||
ln -s /run/runit/supervise.zramd $PKG/etc/sv/zramd/supervise
|
||||
}
|
||||
|
||||
_sysv() {
|
||||
install -Dm755 rc.zramd $PKG/etc/rc.d/zramd
|
||||
}
|
||||
|
||||
scratch isinstalled runit && _runit || _sysv
|
||||
}
|
||||
41
main/venom-zram/venom-zram
Executable file
41
main/venom-zram/venom-zram
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Venom Linux zram script
|
||||
#
|
||||
# License: GPLv3
|
||||
#
|
||||
|
||||
# source config if exist
|
||||
[ -f /etc/venom-zram.conf ] && . /etc/venom-zram.conf
|
||||
|
||||
# check if the compressor is set if not set it
|
||||
[ -z $COMP ] && COMP=lz4
|
||||
|
||||
# MEM is total ram value
|
||||
MEM=$( free --mebi | awk '/Mem:/ {print $2}')
|
||||
|
||||
# check if zram size is set if not set it
|
||||
[ -z $SIZE ] && ZRAM_SIZE=$MEM
|
||||
|
||||
# seting zram size
|
||||
ZRAM_SIZE=$(( $MEM * $SIZE / 100 ))
|
||||
|
||||
make() {
|
||||
modprobe zram
|
||||
zramctl -f -a $COMP -s ${ZRAM_SIZE}MiB > /dev/null
|
||||
mkswap --quiet --label zram0 /dev/zram0
|
||||
swapon --priority 32767 /dev/zram0
|
||||
}
|
||||
|
||||
toss() {
|
||||
swapoff /dev/zram0
|
||||
sleep 1
|
||||
zramctl --reset /dev/zram0
|
||||
rmmod zram
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
make) make ;;
|
||||
toss) toss ;;
|
||||
esac
|
||||
10
main/venom-zram/venom-zram.conf
Executable file
10
main/venom-zram/venom-zram.conf
Executable file
@@ -0,0 +1,10 @@
|
||||
# Venom linux zram config
|
||||
# Venom zram config file
|
||||
|
||||
# Zram size percent
|
||||
SIZE=20
|
||||
|
||||
# Compression algorithms supported : lzo, lz4, lz4hc, deflate, 842 , zstd
|
||||
COMP=lz4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user