util-linux: start init scripts on RUNLEVEL=boot

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-09-07 23:11:57 +02:00
parent c139293fb3
commit afb6f13517

View File

@ -23,29 +23,36 @@
#
# runlevels: openelec, textmode
(
INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
SWAP=`blkid -t TYPE="swap" -o device`
SWAPFILE="$HOME/.cache/swapfile"
case $RUNLEVEL in
boot)
(
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
else
sysctl -w vm.swappiness=60 2>&1 > /dev/null
fi
fi
)&
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
fi
)&
;;
poweroff|reboot)
;;
esac