diff --git a/app/src/main/scripts/update-binary b/app/src/main/scripts/update-binary new file mode 100755 index 000000000..95828f3c5 --- /dev/null +++ b/app/src/main/scripts/update-binary @@ -0,0 +1,45 @@ +#!/sbin/sh + +# Copyright 2013 Koushik Dutta, 2014 Ron Rieve +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# arg 1 is recovery api version, generally 3. +# arg 2 is the pipe fd, to the recovery binary. +# communicate with it using the recovery api. +# arg 3 is the zip file + +echo -n -e 'ui_print Installing F-Droid...\n' > /proc/self/fd/$2 + +FDROID_NAME=F-Droid +FDROID=${FDROID_NAME}.apk +FDROIDDIR=/data/app + +cd /tmp +mkdir fdroid +cd fdroid +unzip -o "$3" +if [ "$?" -ne "0" ] +then + cp /cache/${FDROID} . +fi + +mount /data + +cp ${FDROID} ${FDROIDDIR} +chmod 644 ${FDROIDDIR}/${FDROID} + +umount /data + +echo -n -e 'ui_print done\n' > /proc/self/fd/$2 +echo -n -e 'ui_print\n' > /proc/self/fd/$2 diff --git a/create_ota.sh b/create_ota.sh new file mode 100755 index 000000000..e07a2275f --- /dev/null +++ b/create_ota.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# +# Script to prepare an update.zip containing F-Droid + +set -e + +PROG_DIR=$(dirname $(realpath $0)) + +TMP_DIR=$(mktemp -d -t fdroidclient.tmp.XXXXXXXX) +trap "rm -rf $TMP_DIR" EXIT + +function error() { + echo "*** ERROR: " $@ + usage +} + +function usage() { + cat << EOFU +Usage: $0 variant +where: + - variant is one of: debug, release, or binary +EOFU + exit 1 +} + +# Parse input +VARIANT="$1" +[[ -z "$VARIANT" ]] && error "Missing variant" + +BINARIES="$2" + +GPG="gpg --keyring $PROG_DIR/f-droid.org-signing-key.gpg --no-default-keyring --trust-model always" + +GITVERSION=$(git describe --tags --always) + +FDROID_APK=F-Droid.apk + +# Collect files +mkdir -p $TMP_DIR/META-INF/com/google/android/ +cp app/src/main/scripts/update-binary $TMP_DIR/META-INF/com/google/android/ + +if [ $VARIANT == "binary" ] ; then + curl -L https://f-droid.org/$FDROID_APK > $TMP_DIR/$FDROID_APK + curl -L https://f-droid.org/${FDROID_APK}.asc > $TMP_DIR/${FDROID_APK}.asc + $GPG --verify $TMP_DIR/${FDROID_APK}.asc + rm $TMP_DIR/${FDROID_APK}.asc +else + cd $PROG_DIR + ./gradlew assemble$(echo $VARIANT | tr 'dr' 'DR') + OUT_DIR=$PROG_DIR/app/build/outputs/apk + if [ $VARIANT == "debug" ]; then + cp $OUT_DIR/app-${VARIANT}.apk \ + $TMP_DIR/$FDROID_APK + elif [ -f $OUT_DIR/app-${VARIANT}-signed.apk ]; then + cp $OUT_DIR/app-${VARIANT}-signed.apk \ + $TMP_DIR/$FDROID_APK + else + cp $OUT_DIR/app-${VARIANT}-unsigned.apk \ + $TMP_DIR/$FDROID_APK + fi +fi + +# Make zip +if [ $VARIANT == "binary" ] ; then + ZIPBASE=F-DroidFromBinaries-${GITVERSION} +else + ZIPBASE=F-Droid-${GITVERSION} +fi +if [ $VARIANT == "debug" ]; then + ZIP=${ZIPBASE}-debug.zip +else + ZIP=${ZIPBASE}.zip +fi +OUT_DIR=$PROG_DIR/app/build/distributions +mkdir -p $OUT_DIR +[ -f $OUT_DIR/$ZIP ] && rm -f $OUT_DIR/$ZIP +pushd $TMP_DIR +zip -r $OUT_DIR/$ZIP . +popd diff --git a/f-droid.org-signing-key.gpg b/f-droid.org-signing-key.gpg new file mode 100644 index 000000000..16f1f017a Binary files /dev/null and b/f-droid.org-signing-key.gpg differ