#!/bin/bash VER=2.5 ROM=Froyo_Sense_Revolution MAGLDR=1.13 BUILD1_NAME=${ROM}_${VER}_CWM BUILD2_NAME=${ROM}_${VER}_DFT BUILD1=/tmp/${BUILD1_NAME} BUILD2=/tmp/${BUILD2_NAME} TOOLS=${PWD}/../tools MKYAFFS=${TOOLS}/mkyaffs2image UNYAFFS=${TOOLS}/unyaffs set_perm_recursive() { file=`echo $5 | sed -E 's/\///'` chown -R $1:$2 $file find $file -type d -exec chmod $3 {} \; find $file -type f -exec chmod $4 {} \; } set_perm() { file=`echo $4 | sed -E 's/\///'` chown $1:$2 $file chmod $3 $file } createDFT() { cd ${BUILD1} rm -rf ../${BUILD2_NAME}.7z rm -rf ${BUILD2} mkdir ${BUILD2} cd - # create symlinks for busybox cd ${BUILD1}/system/xbin for file in `cat ${TOOLS}/busybox` do ln -s busybox $file done cd - # create symlinks for toolbox cd ${BUILD1}/system/bin for file in `cat ${TOOLS}/toolbox` do ln -s toolbox $file done cd - # create symlink for su cd ${BUILD1}/system/bin ln -s ../xbin/su cd - # To enable a2sd+ by default # app, app-private and dalvik-cache #cd ${BUILD1}/data #ln -s /sd-ext/app #ln -s /sd-ext/app-private #ln -s /sd-ext/dalvik-cache #cd - # To enable datasd uncomment the lines below #cd ${BUILD1}/data #ln -s /sd-ext/data #touch .datasd #cd - cd ${BUILD1}/system/etc/init.d mv dtapp 04apps2sd cd - # change permissions cd ${BUILD1} set_perm_recursive 0 0 0755 0644 "/system" set_perm_recursive 0 2000 0755 0755 "/system/bin" set_perm 0 3003 02750 "/system/bin/netcfg" set_perm 0 3004 02755 "/system/bin/ping" set_perm 0 2000 06750 "/system/bin/run-as" set_perm_recursive 1002 1002 0755 0440 "/system/etc/bluetooth" set_perm 0 0 0755 "/system/etc/bluetooth" set_perm 1000 1000 0640 "/system/etc/bluetooth/auto_pairing.conf" set_perm 3002 3002 0444 "/system/etc/bluetooth/blacklist.conf" set_perm 1002 1002 0440 "/system/etc/dbus.conf" set_perm 1014 2000 0550 "/system/etc/dhcpcd/dhcpcd-run-hooks" set_perm_recursive 0 2000 0755 0750 "/system/etc/init.d" set_perm 0 0 0755 "/system/etc/init.d" set_perm 0 2000 0550 "/system/etc/init.goldfish.sh" set_perm 0 0 0544 "/system/etc/install-recovery.sh" set_perm_recursive 0 0 0755 0555 "/system/etc/ppp" set_perm_recursive 0 2000 0755 0755 "/system/xbin" set_perm 0 0 06755 "/system/xbin/hcitool" set_perm 0 0 06755 "/system/xbin/librank" set_perm 0 0 06755 "/system/xbin/procmem" set_perm 0 0 06755 "/system/xbin/procrank" set_perm 0 0 06755 "/system/xbin/su" set_perm 0 0 06755 "/system/xbin/tcpdump" cd - # create images cd ${BUILD1} [ -d system ] && ${MKYAFFS} system ${BUILD2}/system.img [ -d boot ] && ${MKYAFFS} boot ${BUILD2}/boot.img [ -d data ] && ${MKYAFFS} data ${BUILD2}/data.img [ -d recovery ] && ${MKYAFFS} recovery ${BUILD2}/recovery.img cd - cp ${TOOLS}/DFT/* ${BUILD2}/. cd ${BUILD2}/.. 7zr a ${BUILD2_NAME}.7z ${BUILD2_NAME} cd - } createCWM() { cd ${BUILD1} rm -rf ../${BUILD1_NAME}.zip rsync --exclude ".svn" -az ${TOOLS}/META-INF . zip -9Dry -X- ../${BUILD1_NAME}.zip * rm -rf META-INF cd - } date mkdir ${BUILD1} echo "Synchronising the build" rsync --exclude ".svn" -az ${PWD}/../build/* ${BUILD1}/. echo "creating initrd" cd ${BUILD1}/boot/initrd find .|cpio -H newc -o|gzip -9 -c - > ../initrd.gz cd - rm -rf ${BUILD1}/boot/initrd # Change the version number in build.prop sed -i s/ro.product.version=.*/ro.product.version=${VER}/g ${BUILD1}/system/build.prop sed -i s/ro.build.description=.*/ro.build.description=${ROM}/g ${BUILD1}/system/build.prop createCWM createDFT rm -rf ${BUILD1} rm -rf ${BUILD2} echo "your files are here" echo "" ls -lh /tmp/${ROM}_${VER}*