[HD2 Android Q&A, Help & Troubleshooting and Genera] HypoTurtle:
Good catch with the typo... the patch installs will be very fast, it would be unnoticable. Will go back to using auto then (at least with the mounter).

A few things I think you misunderstood - the patch zip (#2) is to be run directly after a modified rom zip that 1 has ROM_NAME and install-type added to build.prop and that things aren't unmounted. /boot_dir is where the /sdcard/NativeSD/$ROM_NAME folder is mounted to. (will need to recheck: /sdcard/NativeSD is /boot and /sdcard/NativeSD/$ROM_NAME is /boot_dir or vice versa)

Thus the second zip needs/uses ROM_NAME and desired install type from /system/build.prop (as described above) and we need /boot and /boot_dir to remain mounted as they were by the ROM_zip itself. (This also sorts some potential issue where the ROM_NAME defined in initrd.gz is different from the name of the folder in NativeSD folder).

Easiest way to check if it's working as it should is having an adb shell running during install ... running mount after running the ROM.zip to check what is still mounted, and after running the patcher zip check the work folder to see if things run properly (busybox added to bin, mountfs-$install_type.sh added etc.)

Here is the combined scripts I was working on (1st draft).

#!/sbin/sh

## Bootloader check (copy of checksys.sh)
echo "bootloader=MAGLDR" > /tmp/nfo.prop

output=`grep -i "clk" /proc/cmdline`
if [ -n "$output" ]; then
echo "bootloader=cLK" > /tmp/nfo.prop
fi

install_type=` cat '/tmp/aroma/installtype.prop' | sed 's/selected.1=//g' `
type=(NAND DataOnExt NativeSD DirectSD)
install=${type[$install_type-1]}
ROM_NAME=`cat '/tmp/aroma/ROM_NAME.prop' | sed 's/ROM_NAME=//g'`

if [ -f "/tmp/mount.prop" ]; then
rm "/tmp/mount.prop"
fi

if [ ${install} = 'NativeSD' || ${type} = 'DataOnExt' ]; then
if [ ! -d "/NativeSD" ]; then
mkdir "/NativeSD"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /NativeSD'`
if [ "$mounted" = "" ]; then
mount -t ext4 /dev/block/mmcblk0p2 /NativeSD
fi

# `echo $?` will return 0 if mount is executed successfully
if [ `echo $?` = 0 ]; then
echo 'status=mounted' > "/tmp/mount.prop"
#else
# redirect mount failed messages to aroma-config
fi
### mount_NativeSD
STATUS=`cat '/tmp/mount.prop' | sed 's/status=//g'`
if [ "$STATUS" = "mounted" ]; then
if [ ${install} = 'NativeSD' ]; then

mkdir -p /NativeSD/$ROM_NAME/system
mkdir -p /NativeSD/$ROM_NAME/data

mount --bind /NativeSD/$ROM_NAME/system /system
mount --bind /NativeSD/$ROM_NAME/data /data

mkdir -p /sdcard/NativeSD/$ROM_NAME
mkdir -p /boot
mkdir -p /boot_dir

mount --bind /sdcard/NativeSD/$ROM_NAME /boot
mount --bind /sdcard/NativeSD /boot_dir

# delete the old system
rm -rf /system/*

echo "NativeSD=true" >> /tmp/nfo.prop

else

mkdir -p /NativeSD/$ROM_NAME/data
mount --bind /NativeSD/$ROM_NAME/data /data
echo "DataOnEXT=true" >> /tmp/nfo.prop
fi
else
# no SD-EXT partition found
echo "NativeSD=false" >> /tmp/nfo.prop
fi
fi
if [ ${install} = 'DirectSD' ]; then
if [ ! -d "/DirectSystem" ]; then
mkdir "/DirectSystem"
fi

if [ ! -d "/DirectData" ]; then
mkdir "/DirectData"
fi

# Mount the SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p2 on /DirectSystem'`
if [ "$mounted" = "" ]; then
mount -t ext4 /dev/block/mmcblk0p2 /DirectSystem
fi

# Mount the second SD-EXT partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ "$mounted" = "" ]; then
mount -t ext4 /dev/block/mmcblk0p3 /DirectData
fi

# Mount F2FS partition
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ "$mounted" = "" ]; then
mount -t f2fs /dev/block/mmcblk0p3 /DirectData
fi

# `echo $?` will return 0 if mount is executed successfully
mounted=`mount | grep '/dev/block/mmcblk0p3 on /DirectData'`
if [ `echo $?` = 0 ]; then
echo 'status=mounted' > "/tmp/mount.prop"
#else
# redirect mount failed messages to aroma-config
fi
##mount_DirectSD.sh
STATUS=`cat '/tmp/mount.prop' | sed 's/status=//g'`
if [ "$STATUS" = "mounted" ]; then

mkdir -p /DirectSystem/$ROM_NAME/system
mkdir -p /DirectData/$ROM_NAME/data

mount --bind /DirectSystem/$ROM_NAME/system /system
mount --bind /DirectData/$ROM_NAME/data /data

mkdir -p /sdcard/NativeSD/$ROM_NAME
mkdir -p /boot
mkdir -p /boot_dir

mount --bind /sdcard/NativeSD/$ROM_NAME /boot
mount --bind /sdcard/NativeSD /boot_dir

echo "DirectSD=true" >> /tmp/nfo.prop

else

# no SD-EXT partition found
echo "DirectSD=false" >> /tmp/nfo.prop

fi
fi

# Changing install_type to numbered value
if $install='NAND'; then
install_type='1'
fi
if $install='DataOnExt'; then
install_type='2'
fi
if $install='NativeSD'; then
install_type='3'
fi
if $install='DirectSD'; then
install_type='4'
fi

DataOnExtmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
NativeSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t auto -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD

# mount the system data app dir
/bin/busybox mount --bind /NativeSD/rOm/system /system
/bin/busybox mount --bind /NativeSD/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
direct=`mount | grep mmcblk0p3 | grep ext4`
if [ -n "$direct" ]; then
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t ext4 -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
else
DirectSDmount="#!/bin/busybox sh

# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3

# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 > /e2fsck.log

# mount the 1st (NativeSD) SD-EXT partition
/bin/busybox mkdir -p /DirectSystem
/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ext4 -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /DirectSystem
/bin/busybox mount -t f2fs -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData

# mount the system data app dir
/bin/busybox mount --bind /DirectSystem/rOm/system /system
/bin/busybox mount --bind /DirectData/rOm/data /data

# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin
"
fi
## Setting up working directory
cp /tmp/initrd.gz /tmp/initrd-$ROM_NAME.gz
mkdir -p /tmp/work
cd /tmp/work

## Unzipping nand kernel
gzip -d -c ../initrd-$ROM_NAME.gz | cpio -i -d
mkdir bin
cp /tmp/busybox bin/busybox
cp /tmp/e2fsck bin/e2fsck
cat ${type}mount > mountfs-${type}.sh
cp /tmp/mountfs-${install}.sh mountfs-${install}.sh
chmod 0777 mountfs-${install}.sh
chmod 0777 bin/busybox
chmod 0777 bin/e2fsck

## Modifying ramdisk to not use yaffs, and use sd partitions instead.
if [ "${install_type}" -gt 2 ]; then
sed -i '/mtd@misc/s/^/#/' ueventd.htcleo.rc
sed -i '/mount yaffs2/s/^/#/
s/# #/# /g' init.rc
sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
fi

## Checking if anything other than nand is to be installed
if [ "${install_type}" -gt 1 ]; then
sed -i '/on fs/ a exec /mountfs-'${install}'.sh' init.rc
sed -i "s/rOm/$ROM_NAME/g" mountfs-${install}.sh
chmod 0750 init.rc
chmod 0644 ueventd.htcleo.rc
fi

# Building new ramdisk
find .| cpio -o -H newc | gzip -9 > ../initrd-done.gz
cd ..

# Checking bootloader
if [ "${bootloader}" != "cLK" ]; then
cat initrd-done.gz >> 6MB
cp 6MB /boot/initrd.gz
cp /tmp/zImage /boot/zImage
#Checking if nand install
if [ "${install_type}" -gt 2 ]; then
cp 6MB /boot_dir/initrd.gz
cp /tmp/zImage /boot_dir/zImage
fi
else
cp initrd-done.gz /tmp/initrd.gz
chmod 0755 /tmp/mkbootimg
chmod 0755 /tmp/mkbootimg.sh
exec /tmp/mkbootimg.sh
if [ "${install_type}" -lt 3 ]; then
flash_image boot /tmp/boot.img else
flash_image sboot /tmp/boot.img
fi
fi

cp /tmp/initrd-$ROM_NAME.gz /tmp/initrd.gz