Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue for broker bash script #1276

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions brokerRedirectPrint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ java_bin=$JAVA_HOME/jre/bin
keytool=$java_bin/keytool

debug_key_store=$HOME/.android/debug.keystore
release_alias="androiddebugkey"
release_key_store=$HOME/.android/release.keystore
release_password="android"
debug_alias="androiddebugkey"
debug_password="android"

release_key_store=$HOME/.android/ms-release-key.keystore
release_alias=""
release_password=""
android_key_store=

usage() {
Expand Down Expand Up @@ -91,12 +94,30 @@ rawurlencode() {
echo "${encoded}" # You can either set a return variable (FASTER)
REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}

urlencode() {
# urlencode <string>
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c"
esac
done
}
#---------------------------------

#---------------------------------
# Simple Func() to generate the hash from the certificate provided by the android keystore.
makeTag() {
tag=`$keytool -storepass $release_password -exportcert -alias $release_alias -keystore $android_key_store | openssl sha1 -binary | openssl base64`
tag=$(urlencode $tag)
}

makeDebugTag() {
tag=`$keytool -storepass $debug_password -exportcert -alias $debug_alias -keystore $android_key_store | openssl sha1 -binary | openssl base64`
tag=$(urlencode $tag)
}
#---------------------------------

Expand Down Expand Up @@ -140,11 +161,11 @@ makedebug() {

echo "We are using the following values"
printf "Package Name: %s\n" $package_name
printf "Keystore alias: %s\n" $release_alias
printf "Keystore password: %s\n" $release_password
printf "Keystore alias: %s\n" $debug_alias
printf "Keystore password: %s\n" $debug_password
printf "Keystore: %s\n" $android_key_store

makeTag
makeDebugTag
echo "Debug Redirect URI is:"
makeReplyURL

Expand All @@ -170,8 +191,4 @@ if [ "$debug" = "1" ]; then
fi
if [ "$release" = "1" ]; then
makerelease
fi




fi