Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@v3l0c1r4pt0r
Created February 1, 2021 16:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save v3l0c1r4pt0r/c3e64d2aaca6486c43e914d448a6743c to your computer and use it in GitHub Desktop.
Save v3l0c1r4pt0r/c3e64d2aaca6486c43e914d448a6743c to your computer and use it in GitHub Desktop.
Script for installing multi-APK applications in Android (requires root)
#!/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