mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-02 07:27:49 +00:00
util-linux-ng: rework init scripts
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
4964f40861
commit
3e2a789ca2
49
packages/sysutils/util-linux-ng/init.d/09_swapfile → packages/sysutils/util-linux-ng/init.d/32_swapfile
Executable file → Normal file
49
packages/sysutils/util-linux-ng/init.d/09_swapfile → packages/sysutils/util-linux-ng/init.d/32_swapfile
Executable file → Normal file
@ -1,5 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
################################################################################
|
||||
# Copyright (C) 2009-2010 OpenELEC.tv
|
||||
# http://www.openelec.tv
|
||||
@ -25,32 +23,31 @@
|
||||
#
|
||||
# runlevels: openelec, textmode
|
||||
|
||||
. /etc/profile
|
||||
(
|
||||
INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
|
||||
SWAP=`blkid -t TYPE="swap" -o device`
|
||||
SWAPFILE="$HOME/.cache/swapfile"
|
||||
|
||||
INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
|
||||
SWAP=`blkid -t TYPE="swap" -o device`
|
||||
SWAPFILE="$HOME/.cache/swapfile"
|
||||
if [ "$INSTALLED_MEMORY" -le "500000" ]; then
|
||||
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
||||
progress "creating swapfile"
|
||||
mkdir -p $HOME/.cache
|
||||
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
|
||||
mkswap $SWAPFILE 2>&1 > /dev/null
|
||||
fi
|
||||
|
||||
if [ "$INSTALLED_MEMORY" -le "500000" ]; then
|
||||
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
||||
progress "creating swapfile"
|
||||
mkdir -p $HOME/.cache
|
||||
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
|
||||
mkswap $SWAPFILE 2>&1 > /dev/null
|
||||
fi
|
||||
progress "enable swap"
|
||||
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
||||
for i in $SWAP; do
|
||||
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
||||
done
|
||||
|
||||
progress "enable swap"
|
||||
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
||||
for i in $SWAP; do
|
||||
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
||||
done
|
||||
|
||||
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
||||
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
||||
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
||||
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
||||
else
|
||||
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
||||
fi
|
||||
else
|
||||
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
||||
sysctl -w vm.swappiness=0 2>&1 > /dev/null
|
||||
fi
|
||||
else
|
||||
sysctl -w vm.swappiness=0 2>&1 > /dev/null
|
||||
fi
|
||||
|
||||
)&
|
Loading…
x
Reference in New Issue
Block a user