[Motorola Milestone Android Development] mrvek:
Description:

A small command line tool to create, delete, enable or disable swap file on sdcard and autostart swap file or partition on boot (zRam (compcache) is configured through system Settings))

Features:

- Automatic detection of partitions and files: if you do not have a dedicated swap partition, script uses swapping to file - first on sd-ext and if that one does not exist then it swaps to sdcard. Swap partition takes precedence over files. This should work no matter if you have or do not have ext partition (for app2ext) on sd card.

- create and delete swap file - you can test different sizes without rebooting

- ability to start and stop swapping where ever it may be configured: biggest advantage of this is that you can stop swap if you have it on your /sdcard so you can use mass storage mode. Also, you can test various sizes for swap files or how your system works when swap is disabled, without need for a reboot

- misc. activities: view status of swap partition/files and status of memory

Usage:

Disable startup: swapconf 0 -> disables startup script
Enable startup: swapconf 1 -> enables startup script
Create swap file: swapconf mkf size_in_MB -> creates swap file of specified size (e.g. swapconf mkf 30 for 30MB swap file)
Remove swap file: swapconf rmf -> removes previously created swap file
Start swap: swapconf start p|f -> starts swapping to partition (p) or file (f)
Stop swap: swapconf stop -> stops swapping whereever it may be started
View swap status: swapconf status -> view status of swaps and memory

NOTE: Enabling both swapping to partition and to file is not supported.
If you have a dedicated swap partition on sdcard it will be used if enabled. Otherwise you need to configure swap file.

The attachment is OpenRecovery flashable update zip. Simply apply update.

Startup script should persist across new ROM updates until you do a factory reset (wipe data)

Feedback is welcome ;)

Changes for version 0.2:

- relocated script from /data/local/bin to /system/bin: if your terminal app does not export /data/local/bin to PATH that should not be an issue anymore. Script should still persist across ROM updates [thanks to kabaldan for the tips :)], startup script should persist until you do a factory reset (or you delete/disable it ;)).

- reworked script commands: previously you were not able to create swap file without enabling startup script

- improved partitions detection

- fixed a bug where you could not stop swapping to file if zRam was active

- mics. fixes and cleanups

Changes for version 0.2b:

- fixed backup of swapconf script during ROM upgrade on CM10

Notes:

- script will not persist when changing different ROM versions, e.g. from CM7 to CM10

- kabaldan and Skrilax_CZ have informed me that it is a bad idea to have active swap on sdcard's FAT32 partition unless there is an app that will disable swapping when the sd card is going to be mounted to PC. So far, the only issue I have noticed is that you can not mount USB mass storage mode until you turn off swap so I left that possibility enabled. The choice is yours (btw., it uses fat32 partition only if you have no dedicated swap partition or ext partition).