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
|
# Copyright (C) 2009-2010 OpenELEC.tv
|
||||||
# http://www.openelec.tv
|
# http://www.openelec.tv
|
||||||
@ -25,32 +23,31 @@
|
|||||||
#
|
#
|
||||||
# runlevels: openelec, textmode
|
# 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}'`
|
if [ "$INSTALLED_MEMORY" -le "500000" ]; then
|
||||||
SWAP=`blkid -t TYPE="swap" -o device`
|
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
||||||
SWAPFILE="$HOME/.cache/swapfile"
|
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
|
progress "enable swap"
|
||||||
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
||||||
progress "creating swapfile"
|
for i in $SWAP; do
|
||||||
mkdir -p $HOME/.cache
|
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
||||||
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
|
done
|
||||||
mkswap $SWAPFILE 2>&1 > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
progress "enable swap"
|
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
||||||
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
||||||
for i in $SWAP; do
|
else
|
||||||
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
||||||
done
|
fi
|
||||||
|
|
||||||
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
|
||||||
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
|
||||||
else
|
else
|
||||||
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
sysctl -w vm.swappiness=0 2>&1 > /dev/null
|
||||||
fi
|
fi
|
||||||
else
|
)&
|
||||||
sysctl -w vm.swappiness=0 2>&1 > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user