mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-02 15:37:49 +00:00
util-linux: start init scripts on RUNLEVEL=boot
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
c139293fb3
commit
afb6f13517
@ -23,29 +23,36 @@
|
|||||||
#
|
#
|
||||||
# runlevels: openelec, textmode
|
# runlevels: openelec, textmode
|
||||||
|
|
||||||
(
|
case $RUNLEVEL in
|
||||||
INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
|
boot)
|
||||||
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 [ "$INSTALLED_MEMORY" -le "500000" ]; then
|
||||||
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
|
||||||
progress "creating swapfile"
|
progress "creating swapfile"
|
||||||
mkdir -p $HOME/.cache
|
mkdir -p $HOME/.cache
|
||||||
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
|
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
|
||||||
mkswap $SWAPFILE 2>&1 > /dev/null
|
mkswap $SWAPFILE 2>&1 > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
progress "enable swap"
|
progress "enable swap"
|
||||||
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
[ -z "$SWAP" -a -f "$SWAPFILE" ] && SWAP=$SWAPFILE
|
||||||
for i in $SWAP; do
|
for i in $SWAP; do
|
||||||
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
swapon -p 10000 $SWAP 2>&1 > /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
if [ "$INSTALLED_MEMORY" -le "260000" ]; then
|
||||||
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
sysctl -w vm.swappiness=100 2>&1 > /dev/null
|
||||||
else
|
else
|
||||||
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
sysctl -w vm.swappiness=60 2>&1 > /dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
)&
|
)&
|
||||||
|
;;
|
||||||
|
|
||||||
|
poweroff|reboot)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
Loading…
x
Reference in New Issue
Block a user