slitaz-boot-scripts rev 30
Add option: swap=size (size must be in Mb)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Feb 23 02:26:15 2008 +0100 (2008-02-23) |
parents | 1e2fdd797456 |
children | 7bcff1537b8a |
files | etc/init.d/bootopts.sh |
line diff
1.1 --- a/etc/init.d/bootopts.sh Sat Feb 23 01:56:34 2008 +0100 1.2 +++ b/etc/init.d/bootopts.sh Sat Feb 23 02:26:15 2008 +0100 1.3 @@ -47,6 +47,18 @@ 1.4 mount_home 1.5 fi 1.6 1.7 +# Check if swap file must be generated: swap=size (Mb). 1.8 +# 1.9 +if grep -q "swap=[1-9]*" /proc/cmdline; then 1.10 + SWAP_SIZE=`cat /proc/cmdline | sed 's/.*swap=\([^ ]*\).*/\1/'` 1.11 + # DD to gen a virtual disk. 1.12 + echo -n "Generating swap file: /home/swap ($SWAP_SIZE)..." 1.13 + dd if=/dev/zero of=/home/swap bs=1M count=$SIZE 2>/dev/null 1.14 + status 1.15 + # Make the Linux swap filesystem. 1.16 + mkswap /home/swap 1.17 +fi 1.18 + 1.19 # Active an eventual swap file in /home and on local hd. 1.20 # 1.21 if [ -f "/home/swap" ]; then