summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO17
-rw-r--r--PKGBUILD21
-rw-r--r--apk-resigner.install3
-rw-r--r--signapk.sh38
4 files changed, 79 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..dcde782de14
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,17 @@
+pkgbase = apk-resigner
+ pkgdesc = A bash script utility that resigns the Android Package (APK) files (Android applications) with different certificates.
+ pkgver = 1
+ pkgrel = 1
+ url = https://code.google.com/p/apk-resigner/
+ install = apk-resigner.install
+ arch = i686
+ arch = x86_64
+ arch = arm
+ license = Apache License 2.0
+ source = signapk.sh
+ source = apk-resigner.install
+ sha512sums = fce7e6fbf9ed702f559772535eb8078756cf1c69c2873e71a1421f8e05d5039d0fa88157cd21d607554720edb72f70774be4589ba08569fbe7c8b42cd91d03d6
+ sha512sums = 94bc7f2874c51c215c4ec60dd6226ce3b12e85669b5104cf9504a9caeb6d506562212b6ac813b0653a71de9dc6acbf340501d8cf5be5174ef0aa274478ce9d37
+
+pkgname = apk-resigner
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..6a1254d94cc
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,21 @@
+# Maintainer: Victor Häggqvist <aur a snilius d com>
+# https://github.com/victorhaggqvist/archlinux-pkgbuilds/tree/otto
+
+pkgname=apk-resigner
+pkgver=1
+pkgrel=1
+pkgdesc='A bash script utility that resigns the Android Package (APK) files (Android applications) with different certificates.'
+url="https://code.google.com/p/apk-resigner/"
+arch=('i686' 'x86_64' 'arm')
+license=('Apache License 2.0')
+install=apk-resigner.install
+
+source=("signapk.sh" "apk-resigner.install")
+sha512sums=('fce7e6fbf9ed702f559772535eb8078756cf1c69c2873e71a1421f8e05d5039d0fa88157cd21d607554720edb72f70774be4589ba08569fbe7c8b42cd91d03d6'
+ '94bc7f2874c51c215c4ec60dd6226ce3b12e85669b5104cf9504a9caeb6d506562212b6ac813b0653a71de9dc6acbf340501d8cf5be5174ef0aa274478ce9d37')
+
+package() {
+ install -Dm0755 ${srcdir}/signapk.sh ${pkgdir}/usr/bin/signapk.sh
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/apk-resigner.install b/apk-resigner.install
new file mode 100644
index 00000000000..ce24600a2c3
--- /dev/null
+++ b/apk-resigner.install
@@ -0,0 +1,3 @@
+post_install() {
+ echo "Executable is called signapk.sh"
+}
diff --git a/signapk.sh b/signapk.sh
new file mode 100644
index 00000000000..666adb0a126
--- /dev/null
+++ b/signapk.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Sample usage is as follows;
+# ./signapk myapp.apk debug.keystore android androiddebugkey
+#
+# param1, APK file: Calculator_debug.apk
+# param2, keystore location: ~/.android/debug.keystore
+# param3, key storepass: android
+# param4, key alias: androiddebugkey
+
+USER_HOME=$(eval echo ~${SUDO_USER})
+
+# use my debug key default
+APK=$1
+KEYSTORE="${2:-$USER_HOME/.android/debug.keystore}"
+STOREPASS="${3:-android}"
+ALIAS="${4:-androiddebugkey}"
+
+
+# get the filename
+APK_BASENAME=$(basename $APK)
+SIGNED_APK="signed_"$APK_BASENAME
+
+#debug
+echo param1 $APK
+echo param2 $KEYSTORE
+echo param3 $STOREPASS
+echo param4 $ALIAS
+
+# delete META-INF folder
+zip -d $APK META-INF/\*
+
+# sign APK
+jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $KEYSTORE -storepass $STOREPASS $APK $ALIAS
+#verify
+jarsigner -verify $APK
+
+#zipalign
+zipalign -v 4 $APK $SIGNED_APK \ No newline at end of file