# HG changeset patch # User Christophe Lincoln # Date 1203729975 -3600 # Node ID 637353cad5a533560c1b22947116261c01c2c663 # Parent 1e2fdd797456fdede4c91fc27aca90b97d4b4916 Add option: swap=size (size must be in Mb) diff -r 1e2fdd797456 -r 637353cad5a5 etc/init.d/bootopts.sh --- a/etc/init.d/bootopts.sh Sat Feb 23 01:56:34 2008 +0100 +++ b/etc/init.d/bootopts.sh Sat Feb 23 02:26:15 2008 +0100 @@ -47,6 +47,18 @@ mount_home fi +# Check if swap file must be generated: swap=size (Mb). +# +if grep -q "swap=[1-9]*" /proc/cmdline; then + SWAP_SIZE=`cat /proc/cmdline | sed 's/.*swap=\([^ ]*\).*/\1/'` + # DD to gen a virtual disk. + echo -n "Generating swap file: /home/swap ($SWAP_SIZE)..." + dd if=/dev/zero of=/home/swap bs=1M count=$SIZE 2>/dev/null + status + # Make the Linux swap filesystem. + mkswap /home/swap +fi + # Active an eventual swap file in /home and on local hd. # if [ -f "/home/swap" ]; then