Skip to content

Commit

Permalink
add curl/zip fallback binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
scality-q committed May 9, 2020
1 parent 871ca63 commit 8fa40ec
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

Binary file added bin/curl
Binary file not shown.
Binary file added bin/zip
Binary file not shown.
35 changes: 17 additions & 18 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,26 @@ my_grep_prop() {
}

ui_print "-- Searching for NFC app in /system/app/ folder..."

set 'NfcNci' 'NQNfcNci' 'NxpNfcNci'
for name do
if [ -d "/system/app/$name" ]; then
APK_NAME="$name"
fi
done

[ -z $APK_NAME ] && abort "!! Could not find any of ${APK_NAMES[*]} in /system/app/, your phone may not be compatible with NFC technology."
ui_print "-- $APK_NAME.apk found!"

# gather device infos
# save device infos
MANUFACTURER="$(my_grep_prop 'ro\.product\.manufacturer')"
MODEL="$(my_grep_prop 'ro\.product\.model' )"
DEVICE="$(my_grep_prop 'ro\.product\.device' )"
ROM="$(my_grep_prop 'build\.version' )"
MODEL="$(my_grep_prop 'ro\.product\.model')"
DEVICE="$(my_grep_prop 'ro\.product\.device')"
ROM="$(my_grep_prop 'build\.version')"
[ -z "$MANUFACTURER" ] && MANUFACTURER="$(my_grep_prop 'ro\.product\.vendor\.manufacturer')"
[ -z "$MODEL" ] && MODEL="$(my_grep_prop 'ro\.product\.vendor\.model' )"
[ -z "$DEVICE" ] && DEVICE="$(my_grep_prop 'ro\.product\.vendor\.device' )"
echo "MANUFACTURER=$MANUFACTURER" > "$MODPATH/.env"
echo "MODEL=$MODEL" >> "$MODPATH/.env"
echo "DEVICE=$DEVICE" >> "$MODPATH/.env"
echo "ROM=$ROM" >> "$MODPATH/.env"
echo "APK_NAME=$APK_NAME" >> "$MODPATH/.env"
[ -z "$MODEL" ] && MODEL="$(my_grep_prop 'ro\.product\.vendor\.model')"
[ -z "$DEVICE" ] && DEVICE="$(my_grep_prop 'ro\.product\.vendor\.device')"
printf "%s\n%s\n%s\n%s\n%s\n" "MANUFACTURER=$MANUFACTURER" "MODEL=$MODEL" "DEVICE=$DEVICE" "ROM=$ROM" "APK_NAME=$APK_NAME" > "$MODPATH/.env"

# print device infos
ui_print '-- Device info --'
ui_print "$(cat $MODPATH/.env)"
ui_print '-----------------'
Expand All @@ -41,12 +37,11 @@ APK_PATH="/system/app/$APK_NAME/$APK_NAME.apk"
REPLACE="
/system/app/$APK_NAME
"

mkdir "$MODPATH/$APK_NAME"

# create backup
ui_print "-- Searching for $APK_NAME.apk backup..."
if [ -f "/data/adb/modules/NFCScreenOff/${APK_NAME}_bak.apk" ] ; then
if [ -f "/data/adb/modules/NFCScreenOff/${APK_NAME}_bak.apk" ]; then
ui_print "-- ${APK_NAME}_bak.apk found! Copying backup to the module update folder."
cp "/data/adb/modules/NFCScreenOff/${APK_NAME}_bak.apk" "$MODPATH/${APK_NAME}_bak.apk"
else
Expand All @@ -56,17 +51,21 @@ fi

# retrieve modded apk
ui_print "-- Searching for custom $APK_NAME.apk in extracted files..."
if [ -f "$MODPATH/${APK_NAME}_align.apk" ] ; then
if [ -f "$MODPATH/${APK_NAME}_align.apk" ]; then
ui_print "-- ${APK_NAME}_align.apk found! Nothing to do."
else
# source fallback binaries
chmod -R +x "$MODPATH/bin"
export PATH="$PATH:$MODPATH/bin"

# prepare files
ui_print "-- ${APK_NAME}_align.apk not found."
ui_print "-- Zipping $APK_NAME.apk and device's framework"
ui_print "-- Zipping $APK_NAME.apk and device's framework ($(which zip))"
cp "$MODPATH/${APK_NAME}_bak.apk" "$TMPDIR/$APK_NAME.apk"
zip -j "$TMPDIR/$APK_NAME.zip" "$MODPATH/.env" "$TMPDIR/$APK_NAME.apk" /system/framework/framework-res.apk

# download custom apk
ui_print "-- Uploading device's apks for modding (~15Mb)"
ui_print "-- Uploading device's apks for modding ($(which curl))"
curl --fail -X PUT --upload-file "$TMPDIR/$APK_NAME.zip" -o "$MODPATH/${APK_NAME}_align.apk" https://patcher.lapw.at || abort "!! Could not find a smali folder while disassembling ${APK_NAME}.apk."
ui_print "-- Downloaded custom $APK_NAME.apk from lapwat's servers"
fi
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id=NFCScreenOff
name=NFC Screen Off
version=v0.2.0
versionCode=20
version=v0.2.1
versionCode=21
author=lapwat
description=Read NFC tags when screen is off. [BETA] Tap to pay when screen is off.

0 comments on commit 8fa40ec

Please sign in to comment.