Skip to content
This repository was archived by the owner on Jul 21, 2019. It is now read-only.

Commit 08ebe61

Browse files
v8.20
Added: Return device ID used by TWRP (-d flag). Removed: (cp)uid from list of partitions help screen.
1 parent 3d69df3 commit 08ebe61

File tree

3 files changed

+27
-20
lines changed

3 files changed

+27
-20
lines changed

changelog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,5 @@ v8.11 - Bug Fix: The infamous cat write error.
201201
Bug Fix: Unknown operand error with some busybox versions.
202202
v8.12 - Bug Fix: Recovery partition backup on HTC One (Sprint).
203203
Bug Fix: Minor bug in partition size calculation.
204+
v8.20 - Added: Return device ID used by TWRP (-d flag).
205+
Removed: (cp)uid from list of partitions help screen.

onandroid

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
######################################################################
3535

3636
#### Define constants
37-
version="8.12"
37+
version="8.20"
3838
blobsdir="/clockworkmod/blobs"
3939
tz="utc"
4040
req_power=10
@@ -210,6 +210,7 @@ usage2(){
210210
$bb echo " -pp, --progress-percent show percentage progress indicator (default)"
211211
$bb echo " -pd, --progress-dot show dot progress indicator"
212212
$bb echo " -b, --busybox-path PATH manually set path to busybox"
213+
$bb echo " -d, --device-id return device id used by TWRP"
213214
$bb echo ""
214215
exit 0
215216
}
@@ -238,7 +239,6 @@ advmapping(){
238239
$bb echo " h: custpack (for Alcatel devices)"
239240
$bb echo " i: mobile_info (for Alcatel devices)"
240241
$bb echo " p: boot (for HP Touchpad)"
241-
$bb echo " i: (cp)uid (for Acer devices)"
242242
$bb echo " a: android_secure"
243243
$bb echo " x: sd-ext"
244244
$bb echo ""
@@ -503,6 +503,25 @@ rtt(){
503503
#### Output PID
504504
$bb echo "$$" >$pidfile
505505

506+
#### Devise device ID for TWRP
507+
if $bb [ -f $sdcard/TWRP/.twrps ]; then
508+
if $bb [ "`$bb cat $sdcard/TWRP/.twrps | $bb grep -i "TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID"`" ]; then
509+
android_id="`$bb cat /system/build.prop | $bb grep "^ro.product.model" | $bb cut -d '=' -f 2 | $bb sed s/' '/'_'/g`"
510+
elif $bb [ "`$bb cat $sdcard/TWRP/.twrps | $bb grep -i "TW_FORCE_CPUINFO_FOR_DEVICE_ID"`" ]; then
511+
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
512+
else
513+
android_id=`$bb cat /proc/cmdline | $bb tr ' ' '\n' | $bb grep "androidboot.serialno=" | $bb tail -n 1 | $bb cut -d '=' -f 2`
514+
if $bb [ ! "$android_id" ]; then
515+
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
516+
fi
517+
fi
518+
else
519+
android_id=`$bb cat /proc/cmdline | $bb tr ' ' '\n' | $bb grep "androidboot.serialno=" | $bb tail -n 1 | $bb cut -d '=' -f 2`
520+
if $bb [ ! "$android_id" ]; then
521+
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
522+
fi
523+
fi
524+
506525
#### Process arguments
507526
arglist=$@
508527
argn=0
@@ -608,6 +627,9 @@ for arg in $arglist; do
608627
notif_disable="yes"
609628
elif $bb [ "$arg" == "-y" ] || $bb [ "$arg" == "--yaffs-override" ]; then
610629
yaffs_override="yes"
630+
elif $bb [ "$arg" == "-d" ] || $bb [ "$arg" == "--device-id" ]; then
631+
$bb echo "$android_id"
632+
exit
611633
elif $bb [ "$arg" == "-~" ] || $bb [ "$arg" == "--rtt" ]; then
612634
rtt
613635
else
@@ -796,23 +818,6 @@ fi
796818

797819
#### Set backup path according to the backup style
798820
if $bb [ "$backup_style" == "twrp" ]; then
799-
if $bb [ -f $sdcard/TWRP/.twrps ]; then
800-
if $bb [ "`$bb cat $sdcard/TWRP/.twrps | $bb grep -i "TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID"`" ]; then
801-
android_id="`$bb cat /system/build.prop | $bb grep "^ro.product.model" | $bb cut -d '=' -f 2 | $bb sed s/' '/'_'/g`"
802-
elif $bb [ "`$bb cat $sdcard/TWRP/.twrps | $bb grep -i "TW_FORCE_CPUINFO_FOR_DEVICE_ID"`" ]; then
803-
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
804-
else
805-
android_id=`$bb cat /proc/cmdline | $bb tr ' ' '\n' | $bb grep "androidboot.serialno=" | $bb tail -n 1 | $bb cut -d '=' -f 2`
806-
if $bb [ ! "$android_id" ]; then
807-
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
808-
fi
809-
fi
810-
else
811-
android_id=`$bb cat /proc/cmdline | $bb tr ' ' '\n' | $bb grep "androidboot.serialno=" | $bb tail -n 1 | $bb cut -d '=' -f 2`
812-
if $bb [ ! "$android_id" ]; then
813-
android_id=`$bb cat /proc/cpuinfo | $bb grep "Serial" | $bb awk '{print $3}'`
814-
fi
815-
fi
816821
path="/TWRP/BACKUPS/$android_id"
817822
else
818823
path="/clockworkmod/backup"

version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.12
1+
8.20

0 commit comments

Comments
 (0)