Add bsd compatibility
This commit is contained in:
+6
-3
@@ -2,7 +2,10 @@
|
||||
# File: android-interact.sh
|
||||
# Date: Sun Jan 11 23:05:58 2015 +0800
|
||||
# Author: Yuxin Wu <[email protected]>
|
||||
PROG_NAME=`readlink -f "$0"`
|
||||
|
||||
source compatibility.sh
|
||||
|
||||
PROG_NAME=`$REALPATH "$0"`
|
||||
PROG_DIR=`dirname "$PROG_NAME"`
|
||||
cd "$PROG_DIR"
|
||||
|
||||
@@ -15,7 +18,7 @@ adb root
|
||||
|
||||
if [[ $1 == "uin" ]]; then
|
||||
adb pull $MM_DIR/shared_prefs/system_config_prefs.xml 2>/dev/null
|
||||
uin=$(grep 'default_uin' system_config_prefs.xml | grep -o 'value="[0-9]*' | cut -c 8-)
|
||||
uin=$(grep 'default_uin' system_config_prefs.xml | $GREP -o 'value="[0-9]*' | cut -c 8-)
|
||||
[[ -n $uin ]] || {
|
||||
echo "Failed to get wechat uin. You can try other methods, or report a bug."
|
||||
exit 1
|
||||
@@ -23,7 +26,7 @@ if [[ $1 == "uin" ]]; then
|
||||
rm system_config_prefs.xml
|
||||
echo "Got wechat uin: $uin"
|
||||
elif [[ $1 == "imei" ]]; then
|
||||
imei=$(adb shell dumpsys iphonesubinfo | grep 'Device ID' | grep -o '[0-9]*')
|
||||
imei=$(adb shell dumpsys iphonesubinfo | grep 'Device ID' | $GREP -o '[0-9]+')
|
||||
[[ -n $imei ]] || {
|
||||
echo "Failed to get imei. You can try other methods, or report a bug."
|
||||
exit 1
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash -e
|
||||
# $File: compatibility.sh
|
||||
# $Date: Mon Jan 19 14:27:25 2015 +0800
|
||||
# Author: Vury Leo <i[at]vuryleo[dot]com>
|
||||
|
||||
realpath() {
|
||||
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
|
||||
}
|
||||
|
||||
if [ `uname` = 'Darwin' ]
|
||||
then
|
||||
REALPATH='realpath'
|
||||
GREP='grep -E'
|
||||
MD5SUM='md5'
|
||||
else
|
||||
REALPATH='readlink -f'
|
||||
GREP='grep'
|
||||
MD5SUM='md5sum'
|
||||
fi
|
||||
|
||||
+3
-1
@@ -3,6 +3,8 @@
|
||||
# Date: Sun Jan 11 22:30:50 2015 +0800
|
||||
# Author: Yuxin Wu <[email protected]>
|
||||
|
||||
source compatibility.sh
|
||||
|
||||
MSGDB=$1
|
||||
imei=$2
|
||||
uin=$3
|
||||
@@ -20,7 +22,7 @@ if [[ -f $output ]]; then
|
||||
fi
|
||||
|
||||
|
||||
KEY=$(echo -n "$imei$uin" | md5sum | cut -b 1-7)
|
||||
KEY=$(echo -n "$imei$uin" | $MD5SUM | cut -b 1-7)
|
||||
echo "KEY: $KEY"
|
||||
|
||||
uname -m | grep x86_64 > /dev/null || version=32bit && version=64bit
|
||||
|
||||
Reference in New Issue
Block a user