[HD2 Android Q&A, Help & Troubleshooting and Genera] HypoTurtle:
That code was working fine earlier so an if statement must have been started somewhere without a condition stated, thus it doesn't have any actions to perform thus the error. Errors with twrp ramdisk are reported during compilation - it's all fine there. It's probably something with the mount script stuff added... I have reworked them to remove the redundancy - for f2fs you will need to format with the twrp recovery i posted. (or format with mkfs.f2fs -e f2fs ...)

#!/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
mkdir /NativeSD
if [ -f "/tmp/Rname.prop" ]; then
ROM_NAME=`cat Rname.prop`
mount -t auto /dev/block/mmcblk0p2 /NativeSD
mount --bind /NativeSD/${ROM_NAME}/system /system
else
ROM_NAME=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF-1)}' | sed 's/\(\[\|\]\)//g' `
fi
mkdir /boot
mkdir /boot_dir
mount --bind /sdcard/NativeSD /boot_dir
mount --bind /sdcard/NativeSD/${ROM_NAME} /boot
## Exporting variables
type=` cat /system/build.prop | grep ro.build.display.id | awk '{print $(NF)}' | sed 's/\(\[\|\]\)//g' `
bootloader=` cat '/tmp/nfo.prop' | sed 's/bootloader=//g' `
## Changing install_type to numbered value
if [ ${type}='NAND' ]; then
install_type='1'
fi
if [ ${type}='DataOnExt' ]; then
install_type='2'
fi
if [ ${type}='NativeSD' ]; then
install_type='3'
fi
if [ ${type}='DirectSD' ]; then
install_type='4'
fi
## Copying zImage and initrd.gz from /boot_dir when one wasn't added to zip
if [ ! -f "/tmp/zImage" ]; then
cp /boot/zImage/ /tmp/zImage
fi
if [ ! -f "/tmp/initrd.gz" ]; then
cp /boot/initrd.gz/ /tmp/initrd.gz
fi
## Checking zImage type
if [ ` hd /tmp/zImage | grep '1f 8b 08' | cut -d ' ' -f '1' ` == ` 00003f80: ` ]; then
`dd if=/dev/zero of=/tmp/6MB bs=1M count=6`
fi
if [ ! -f /tmp/mountfs-${type}.sh ]; then
if [ "${install_type}" -gt 1 ]; then
echo "#!/bin/busybox sh
# wait for 2nd partition ready
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2
wait /dev/block/mmcblk0p2" > mount-${type}.sh
if [ '${type}' == 'DirectSD' ]; then
echo "# wait for 3rd partition ready
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3
wait /dev/block/mmcblk0p3" >>mountfs-${type}.sh
fi
hexdump -C /dev/block/mmcblk0p2 | head -30 | grep 'f2fs'` > /tmp/mt1.txt
if [ -f /dev/block/mmcblk0p3 ]; then
hexdump -C /dev/block/mmcblk0p3 | head -30 | grep 'f2fs'` > /tmp/mt2.txt
fi
if [ `cat /tmp/mt1.txt | head -1` == `00000940` ]; then
mt1='f2fs' else
mt1='ext4'
fi
if [ `cat /tmp/mt2.txt | head -1` == `00000940` ]; then
mt2='f2fs' else
mt2='ext4'
fi
if [ ${mt1} == 'ext4' ]; then
echo "# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p2 /e2fsck.log" >> mountfs-${type}.sh
else
echo "/bin/fsck.f2fs -p /dev/block/mmcblk0p2 /fsckf2fs.log" >> mountfs-${type}.sh
fi
if [ '${type}' == 'DirectSD' ]; then
if [ ${mt2} == 'ext4' ]; then
echo "# check the ext4 fs
/bin/e2fsck -p /dev/block/mmcblk0p3 /e2fsck.log" >> mountfs-${type}.sh
else
echo "/bin/fsck.f2fs -p /dev/block/mmcblk0p3 /fsckf2fs.log" >> mountfs-${type}.sh
fi
fi
echo "/bin/busybox mkdir -p /NativeSD
/bin/busybox mount -t ${mt1} -o ro,noatime,nodiratime,barrier=0 /dev/block/mmcblk0p2 /NativeSD
# mount the system data app dir" >> mountfs-${type}.sh
if [ '${type}' == 'DataOnExt' ]; then
echo "/bin/busybox mount --bind /NativeSD/rOm/data /data" >> mountfs-${type}.sh
else
echo "/bin/busybox mount --bind /NativeSD/rOm/data /system" >> mountfs-${type}.sh
if [ '${type}' == 'NativeSD' ]; then
echo "/bin/busybox mount --bind /NativeSD/rOm/data /data" >> mountfs-${type}.sh
fi
if [ '${type}' == 'DirectSD' ]; then
echo "/bin/busybox mkdir -p /DirectData
/bin/busybox mount -t ${mt2} -o noatime,nodiratime,nosuid,nodev,discard /dev/block/mmcblk0p3 /DirectData
/bin/busybox mount --bind /DirectData/rOm/data /data" >> mountfs-${type}.sh
fi
fi
echo "# cleanup
# delete /bin to free ram
/bin/busybox rm -rf /bin" >> mountfs-${type}.sh
fi
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 /sbin/busybox bin/busybox
cp /sbin/e2fsck bin/e2fsck
cp /tmp/mountfs-${type}.sh mountfs-${type}.sh
if [[ ${mt1} == 'f2fs' || ${mt2} == 'f2fs' ]]; then
cp /sbin/fsck.f2fs bin/fsck.f2fs
chmod 0777 bin/fsck.f2fs
fi
chmod 0777 mountfs-${type}.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-${type}.sh
fi
### Checking for anything other than nand is to be installed
if [ "${install_type}" -gt "1" ]; then
sed -i '/on fs/ a exec /mountfs-'${type}'.sh' init.rc
sed -i "s/rOm/$ROM_NAME/g" mountfs-${type}.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 for 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
rm -r /tmp/work/*