Skip to content

Instantly share code, notes, and snippets.

@Rudxain
Last active February 3, 2025 03:30
Show Gist options
  • Save Rudxain/66d308f7de54facf378f37adee49b624 to your computer and use it in GitHub Desktop.
Save Rudxain/66d308f7de54facf378f37adee49b624 to your computer and use it in GitHub Desktop.
Copy APK from pack name. Minimal dependencies (no ADB required). https://llamalab.com/automate/community/flows/38806
#!/system/bin/sh
set -euf
for pack in "$@"
do
# `cmd package` is "more portable" than `pm`,
# because Termux has its own `cmd` override:
# https://github.com/termux/termux-tools/issues/157#issuecomment-2614142899
# See also:
# https://github.com/termux/termux-packages/discussions/8292#discussioncomment-5102555
REPLY="$(cmd package path "$pack")"
if [[ -z "$REPLY" ]]
then
printf '%s\n' "$pack not found"
else
REPLY=("${REPLY[@]}")
cp "${REPLY[0]:8}" "${pack}.apk"
fi
done
# LICENSE: https://unlicense.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment