summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-11-19 14:38:49 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-11-19 14:38:49 +0200
commitebce94f7a478b0af49412deadac2fbb18c88a27a (patch)
treee0de68e783b43b46189d73cb5ca0365af7dd7496
parentb3f180c03630333103d41db09c35be3becfeaec6 (diff)
improvements to the andre-apk.sh
-rw-r--r--andre-apk.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/andre-apk.sh b/andre-apk.sh
index 90afffa..5a22206 100644
--- a/andre-apk.sh
+++ b/andre-apk.sh
@@ -1,7 +1,7 @@
#!/bin/sh
argv0="$0"
-msg() { printf -- '%s: %s\n' "$(basename "$argv0")" "$@" 1>&2; }
+msg() { printf -- '%s: %s\n' "${argv0##*/}" "$@" 1>&2; }
err() { msg "$@"; exit 1; }
[ -z "$1" ] && err 'usage: <apk>'
@@ -20,7 +20,7 @@ case "$arch" in
;;
esac
-pkgname="$(aapt2 dump --file AndroidManifest.xml "$1" | grep -o '^ \+A: package="[a-zA-Z0-9._]\+"' | awk -F'"' '{print $2}')"
+pkgname="$(aapt2 dump --file AndroidManifest.xml "$1" | sed -nr 's/.*A: package="([^ "]+).*/\1/p')"
[ -z "$pkgname" ] && err "not a valid apk (missing package name)"
tmpdir="$(mktemp -d)"