From 8dda5c9fd8b61150137a51ba8d2fa771f954ae3a Mon Sep 17 00:00:00 2001 From: Kelson Date: Fri, 13 Sep 2019 12:45:14 +0200 Subject: [PATCH] Move a few bash scripts to contrib directory --- .../create-signed-android-release.sh | 30 +++++++++---------- .../install-kiwix-on-device.sh | 10 +++---- .../make-screenshot.sh | 0 3 files changed, 19 insertions(+), 21 deletions(-) rename create-signed-android-release.sh => contrib/create-signed-android-release.sh (81%) rename install-kiwix-on-device.sh => contrib/install-kiwix-on-device.sh (55%) rename make-screenshot.sh => contrib/make-screenshot.sh (100%) diff --git a/create-signed-android-release.sh b/contrib/create-signed-android-release.sh similarity index 81% rename from create-signed-android-release.sh rename to contrib/create-signed-android-release.sh index 636d07537..acda44e7d 100755 --- a/create-signed-android-release.sh +++ b/contrib/create-signed-android-release.sh @@ -1,24 +1,23 @@ #!/bin/bash function usage { - echo "Usage: $0 kiwix-android.keystore [PACKAGE] [APP_VERSION]" - echo "You must specify the path of the certificate keystore." - exit 1 + echo "Usage: $0 kiwix-android.keystore [PACKAGE] [APP_VERSION]" + echo "You must specify the path of the certificate keystore." + exit 1 } if [ -f "$1" ]; - then - CERTIFICATE=$1 +then + CERTIFICATE=$1 else - usage + usage fi function die { - echo -n "[ERROR] " - echo -n $1 - echo -n " Aborting. -" - exit 1 + echo -n "[ERROR] " + echo -n $1 + echo -n " Aborting." + exit 1 } # default values are guessed from repo (AndroidManifest and res/values/branding) @@ -27,14 +26,13 @@ TARGET_VERSION=$(grep "compileSdkVersion" build.gradle | awk '{print $2}') BUILD_VERSION=$(grep "buildToolsVersion" build.gradle | awk '{print $2}' | sed 's/"//g') if [ "x$2" != "x" ]; - then - PACKAGE=$2 +then + PACKAGE=$2 fi - if [ "x$3" != "x" ]; - then - APP_VERSION=$3 +then + APP_VERSION=$3 fi ../src/dependencies/android-sdk/tools/android update project -p . -n kiwix -t android-${TARGET_VERSION} diff --git a/install-kiwix-on-device.sh b/contrib/install-kiwix-on-device.sh similarity index 55% rename from install-kiwix-on-device.sh rename to contrib/install-kiwix-on-device.sh index bfa03fc2c..eecc4b455 100755 --- a/install-kiwix-on-device.sh +++ b/contrib/install-kiwix-on-device.sh @@ -1,19 +1,19 @@ #!/bin/bash # default value is guessed from repo (AndroidManifest) -PACKAGE=$(python -c "from xml.dom.minidom import parse; d=parse('app/src/main/AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])") +PACKAGE=$(python -c "from xml.dom.minidom import parse; d=parse('../app/src/main/AndroidManifest.xml'); print([e.getAttribute('package').strip() for e in d.getElementsByTagName('manifest')][-1])") if [ "x$1" != "x" ]; - then - PACKAGE=$1 +then + PACKAGE=$1 fi -if [ -f app/build/outputs/apk/${PACKAGE}-debug.apk ] +if [ -f ../app/build/outputs/apk/${PACKAGE}-debug.apk ] then echo "Uninstalling old Kiwix APK..." ${ANDROID_HOME}/platform-tools/adb uninstall ${PACKAGE} ; echo "Installing new Kiwix APK..." - ${ANDROID_HOME}/platform-tools/adb install build/outputs/apk/${PACKAGE}-debug.apk + ${ANDROID_HOME}/platform-tools/adb install ../build/outputs/apk/${PACKAGE}-debug.apk else echo "No APK file available for package ${PACKAGE} !" fi diff --git a/make-screenshot.sh b/contrib/make-screenshot.sh similarity index 100% rename from make-screenshot.sh rename to contrib/make-screenshot.sh