Created
February 1, 2021 16:39
-
-
Save v3l0c1r4pt0r/c3e64d2aaca6486c43e914d448a6743c to your computer and use it in GitHub Desktop.
Script for installing multi-APK applications in Android (requires root)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/bin/sh | |
# install multi-file apk with pm | |
if [ "$(id -u)" -ne 0 ]; then | |
echo "Access denied!" | |
exit 1 | |
fi | |
if [ $# -lt 2 ]; then | |
echo "Usage: $0 name apk [[[apk] apk] ...]" | |
exit 1 | |
fi | |
name="$1" | |
shift | |
TOTAL="$(cat $@ | wc -c)" | |
comm="$(pm install-create -S $TOTAL -i $name -r)" | |
left="${comm%*]}" | |
SESS=${left#*\[} | |
for file in $@; do | |
SZ="$(wc -c $file | cut -d' ' -f1)" | |
pm install-write -S $SZ $SESS $file <$file | |
done | |
pm install-commit $SESS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment