[G1 Android Development] jubeh:
Ok, searched and couldn't find, so if you know a thread where this is touched upon, please link to the post?

I'm trying to disable a2sd on JAC's latest rom (compcache just makes it so much more livable) and enable linux swap and compcache. what I ended up doing was modifying the a2sd script so that it checks for a third partition instead of a second, that way, I can disable a2sd by not having a third partition. I also changed the swap script to check for a second partition. I'm pretty much making a2sd optional in order to use compcache (since it's the a2sd script that launches the userinit.sh script at /system/sd, if there's no ext partition, it jumps to else and ignores the part to run userinit.sh). Anyway, I'm wondering how it is that a2sd is being launched on startup, and wether it's being launched on every single boot or just on first boot. I'm wondering because i want to replace it with my own script, now, i could either copy the contents of my script to a2sd script, or i could find out how it is that scripts are auto-launched on android so that i can add them later instead of just appending everything to the a2sd script and hoping it works (since some things will conflict).

Here's my modified script, anyway, if anybody is interested in running compcache and swap without a2sd, only need two partitions, fat32 and linux-swap, if you add a third ext2 partition, then you enable a2sd (data, dalvik-cache, and data-private, I like leaving app_s internal for speed):

notice, this is not MY script per se, just modified from jac's a2sd and the userinit.sh for cyanogen's compcache roms

#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# Thanks to Cyanogen modified by JAC
#
sysctl -p

if [ -e /dev/block/mmcblk0p3 ];
then
# fsck the sdcard filesystem first
e2fsck -y /dev/block/mmcblk0p3;

# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;

# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p3 /system/sd;
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;

# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;

# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
fi;

# move apps and dalvik cache from internal memory to sdcard
for i in app dalvik-cache app-private;
do
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi

busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i

if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
fi;
done;

# symlink app dirs - they must be on the same filesystem
for i in app dalvik-cache app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /system/sd/$i /data/$i;
fi;
done;

# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then rm -f /system/sd/$i; fi
done;

# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /system/sd/app/*.odex

# call a userinit.sh script if it's present on the sdcard
if [ -e /system/sd/userinit.sh ];
then
/system/bin/sh /system/sd/userinit.sh;
fi;

setprop cm.a2sd.active 1;

else

# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;

setprop cm.a2sd.active 0;
fi;

sync;
setprop cm.filesystem.ready 1;

#!/system/bin/sh
# Thanks to Denkai/Dwang

if [ -n /dev/block/mmcblk0p2 ];
then
mkswap /dev/block/mmcblk0p2;
fi;

if [ -e /dev/block/mmcblk0p2 ];
then
echo 20 > /proc/sys/vm/swappiness;
swapon /dev/block/mmcblk0p2;
fi;

insmod /system/modules/lib/modules/2.6.29-cm/compcache/xvmalloc.ko;
insmod /system/modules/lib/modules/2.6.29-cm/compcache/ramzswap.ko disksize_kb=24000;
mknod /dev/ramzswap0 b 253 0;
echo 20 > /proc/sys/vm/swappiness;
swapon /dev/ramzswap0;

exit;