-
-
Save manniru/b1304964cbdb710266a28e31a35e52a0 to your computer and use it in GitHub Desktop.
Script for installing multi-APK applications in Android (requires root)
This file contains hidden or 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