Skip to content

Instantly share code, notes, and snippets.

@bigbiff
Last active February 13, 2024 11:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bigbiff/3914302 to your computer and use it in GitHub Desktop.
Save bigbiff/3914302 to your computer and use it in GitHub Desktop.
Build TWRP for devices
#!/bin/bash
TWRPCM10REPO=/data/repos/cm10-twrp
TWRPCM101REPO=/builds/cm10.1-twrp
TWRPOUTDIR=/home/bigbiff/twrp
cm101devices=('n7100' 't0ltecan' 't0lte' 't0ltetmo' 't0lteatt' 't0ltespr' 't0ltevzw' 't03gduoszn' 't0lteskt')
cm10devices=('quincyatt' 'quincytmo')
contains() {
local i j=$1
shift
for i
do
[[ $i == $j ]] && return 0
done
return 1
}
if [[ $1 != "" ]]
then
devices=( $(echo "$1") )
else
n=${cm101devices[@]}
for ((i=0;i<n;i++)) {
devices[$i]=${cm101devices[$i]}"["${cm10devices[$i]}"]"
}
fi
for dev in ${devices[*]}
do
$(contains $dev ${cm101devices[*]})
if [[ $? == 0 ]]
then
cd $TWRPCM101REPO
ver=$(grep TW_VERSION_STR $TWRPCM101REPO/bootable/recovery/variables.h | awk '{print $3}' | sed 's/"//g')
fi
$(contains $dev ${cm10devices[@]})
if [[ $? == 0 ]]
then
cd $TWRPCM10REPO
ver=$(grep TW_VERSION_STR $TWRPCM10REPO/bootable/recovery/variables.h | awk '{print $3}' | sed 's/"//g')
fi
. ./build/envsetup.sh
lunch cm_$dev-eng > /dev/null 2>&1
make clobber && make recoveryimage -j7 > /dev/null 2>&1
cp out/target/product/$dev/recovery.img $TWRPOUTDIR/openrecovery-twrp-$ver-$dev.img
createodin.sh $TWRPOUTDIR/openrecovery-twrp-$ver-$dev.img
bash -x createtwrpzip.sh $TWRPOUTDIR/openrecovery-twrp-$ver-$dev.img $TWRPOUTDIR/recovery-$dev.zip
for i in `ls $TWRPOUTDIR/ | grep ".*open.*$dev\.?*"`
do
if [[ $dev == "quincyatt" ]]
then
devdir=sgh-i717
elif [[ $dev == "quincytmo" ]]
then
devdir=sgh-t879
else
devdir=$dev
fi
rsync -avz --progress $TWRPOUTDIR/$i techerrata.com:~/twrp2/$devdir
rsync -avz --progress $TWRPOUTDIR/$i OpenRecovery@upload.goo.im:~/public_html/$devdir
done
done
wget -qO- http://techerrata.com/update_index
wget -qO- http://goo.im/update_index
#!/bin/bash
USAGE="USAGE: $0 imgfile"
OUTPUT="/home/bigbiff/twrp"
if [[ $1 == "" ]]
then
echo $USAGE
exit 1
fi
echo "Remember to name the file the same name you want"
echo "the odin tar.md5. Otherwise odin will fail"
echo "For example: instead of recovery.md5, openrecovery-twrp-2.3.0.3-sgh-i717.img"
TAR=`basename $1`
cp $1 /tmp/recovery.img
cd /tmp
#tar -H ustar -c $TAR > /tmp/$TAR.tar
tar -c recovery.img > /tmp/$TAR.tar
#md5sum -t $TAR.tar >> /tmp/$TAR.tar
#mv $TAR.tar $OUTPUT/$TAR.tar.md5
mv $TAR.tar $OUTPUT/$TAR.tar
#!/bin/bash
USAGE="$0 imgfile"
if [[ $1 == "" ]]
then
echo $USAGE
exit 1
fi
file=$1
zip=$2
dir="/home/bigbiff/twrp"
newfile=`basename $file .img`
cp $file /tmp/recovery.img
cd /tmp
7z u $zip recovery.img
cp $zip $dir/$newfile.zip
rm /tmp/recovery.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment