This commit is contained in:
Tomas M
2012-09-06 12:28:08 -05:00
parent ffbcc57bbe
commit 445fe3906b
3 changed files with 112 additions and 45 deletions
+16 -39
View File
@@ -2,53 +2,30 @@
# Initial script for Linux Live Kit
# Author: Tomas M <http://www.linux-live.org/>
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
. /.config
. /linuxkitlib
mount -n -t proc proc /proc
mount -n -t sysfs sysfs /sys
mount -n -o remount,rw rootfs /
ln -sf /proc/mounts /etc/mtab # this allows us to use umount -a
# Don't print kernel messages to konsole any longer
echo "0" >/proc/sys/kernel/printk
# Activate zram (auto-compression of RAM)
# Compressed RAM consumes 1/2 or even 1/4 of original size
# Setup static size of 500MB
echo "Setting dynamic RAM compression using ZRAM"
modprobe zram
echo $((512*1024*1024)) > /sys/block/zram0/disksize
mkswap /dev/zram0
swapon /dev/zram0 -p 32767
echo 100 > /proc/sys/vm/swappiness
MEMORYDIR=/memory
UNIONDIR=/union
# Setup empty union
mkdir $MEMORYDIR
mkdir $UNIONDIR
mount -t ramfs ramfs $MEMORYDIR
mount -t aufs -o xino=$MEMORYDIR/xino,br=$MEMORYDIR none $UNIONDIR
export PATH=.:/:/usr/sbin:/usr/bin:/sbin:/bin
# find LiveKit data
. /.config
. /livekitlib
init_proc
init_devs
init_aufs
init_zram
init_union $MEMORYDIR $UNIONDIR
# find data dir with filesystem bundles
DATA="$(find_data $LIVEKITNAME)"
# copy to RAM if needed
# add data to union
union_append_bundles "$DATA"
# possibly switch root
# testing message
echo
echo
echo
echo " If you see this message, then the test passed OK."
echo " Thank you for testing. That's all for now :)"
echo " It's now safe to turn off your computer ..."
echo
echo
echo
echo
echo "If you see this message, then something went terribly wrong. Sorry!"
/bin/bash