From 822aba9481e4cf0a980180f7816910535cdc6885 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Thu, 20 Jan 2022 13:01:56 +0100 Subject: [PATCH] Better build explanation --- README.md | 49 +++++++++++++++++++++++++++------------------ app/build.gradle | 4 ++-- app/ffmpeg/build.sh | 9 ++++++--- app/libgocryptfs | 2 +- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index ee6609a..ada59ee 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ It currently only works with [gocryptfs](https://github.com/rfjakob/gocryptfs) b

-# Disclamer +# Disclaimer DroidFS is provided "as is", without any warranty of any kind. It shouldn't be considered as an absolute safe way to store files. DroidFS cannot protect you from screen recording apps, keyloggers, apk backdooring, compromised root accesses, memory dumps etc. @@ -48,7 +48,7 @@ It is strongly recommended to read the documentation of a feature before enablin You can download DroidFS from [F-Droid](https://f-droid.org/packages/sushi.hardcore.droidfs) or from the "Releases" section in the repo. -APKs availables here are signed with my PGP key available on keyservers: +APKs available here are signed with my PGP key available on keyservers: `gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 007F84120107191E` \ Fingerprint: `BD5621479E7B74D36A405BE8007F84120107191E` \ @@ -88,11 +88,16 @@ DroidFS use some parts of the original gocryptfs code, which is designed to run # Build Most of the original gocryptfs code was used as is (written in Go) and compiled to native code. That's why you need [Go](https://golang.org) and the [Android Native Development Kit (NDK)](https://developer.android.com/ndk/) to build DroidFS from source. - -#### Install Requirements -- [Android Studio](https://developer.android.com/studio/) -- [Android NDK and CMake](https://developer.android.com/studio/projects/install-ndk) (OpenSSL build fails with NDK versions higher than v22. It should pass with NDK v21.4.7075529 and lower) -- [Go](https://golang.org/doc/install) (on debian: `$ sudo apt-get install golang-go`) +#### Install dependencies +On debian: +``` +$ sudo apt-get install build-essential pkg-config libssl-dev +``` +Install [Go](https://golang.org/doc/install): +``` +$ sudo apt-get install golang-go +``` +You also need to install the Android SDK build tools and the [Android NDK](https://developer.android.com/studio/projects/install-ndk). #### Download Sources ``` @@ -123,28 +128,32 @@ $ cd app/ffmpeg $ git clone --depth=1 https://git.ffmpeg.org/ffmpeg.git ``` +#### Generate a keystore +APKs must be signed to be installed on an Android device. If you don't already have a keystore, you can generate one by running: +``` +$ keytool -genkey -keystore -alias -keyalg EC -validity 10000 +``` + #### Build -First, we need to install some dependencies: -``` -$ sudo apt-get install libcrypto++-dev libssl-dev pkg-config -``` -And also Go dependencies: -``` -$ go get golang.org/x/sys/unix golang.org/x/sys/cpu golang.org/x/crypto/hkdf github.com/jacobsa/crypto/siv github.com/rfjakob/eme -``` -Then, retrieve your Android NDK installation path, usually someting like "/home/\/Android/SDK/ndk/\". We can now build libgocryptfs: +Retrieve your Android NDK installation path, usually something like "/home/\/Android/SDK/ndk/\". Now you can build libgocryptfs: ``` $ cd DroidFS/app/libgocryptfs $ env ANDROID_NDK_HOME="" OPENSSL_PATH="./openssl-1.1.1m" ./build.sh ``` -And also FFmpeg: +Then FFmpeg: ``` $ cd app/ffmpeg $ env ANDROID_NDK_HOME="" ./build.sh ffmpeg ``` -Then, open the DroidFS project with Android Studio. \ -If a device (virtual or physical) is connected, just click on "Run". \ -If you want to generate a signed APK, you can follow this [post](https://stackoverflow.com/a/28938286). +Finally, compile the app: +``` +$ ./gradlew assembleRelease +``` +If the build succeeds, you will find the unsigned APKs in `app/build/outputs/apk/release/`. You need to sign them in order to install the app: +``` +$ apksigner sign --out droidfs.apk -v --ks app/build/outputs/apk/release/ +``` +Now you can install `droidfs.apk` on your device. # Third party code Thanks to these open source projects that DroidFS uses: diff --git a/app/build.gradle b/app/build.gradle index 7cde067..5dd9600 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "sushi.hardcore.droidfs" minSdkVersion 21 targetSdkVersion 29 - versionCode 21 - versionName "1.7.1" + versionCode 22 + versionName "1.7.2" ndk { abiFilters "x86", "x86_64", "armeabi-v7a", "arm64-v8a" diff --git a/app/ffmpeg/build.sh b/app/ffmpeg/build.sh index 509cfbb..70ea64c 100755 --- a/app/ffmpeg/build.sh +++ b/app/ffmpeg/build.sh @@ -1,9 +1,11 @@ #!/bin/bash if [ -z ${ANDROID_NDK_HOME+x} ]; then - echo "Error: \$ANDROID_NDK_HOME is not defined." + echo "Error: \$ANDROID_NDK_HOME is not defined." >&2 + exit 1 elif [ $# -lt 1 ]; then - echo "Usage: $0 []" + echo "Usage: $0 []" >&2 + exit 1 else FFMPEG_DIR=$1 compile_for_arch() { @@ -76,7 +78,8 @@ else mkdir -p build/$1/libavformat build/$1/libavcodec build/$1/libavutil && cp $FFMPEG_DIR/libavformat/*.h $FFMPEG_DIR/libavformat/libavformat.so build/$1/libavformat && cp $FFMPEG_DIR/libavcodec/*.h $FFMPEG_DIR/libavcodec/libavcodec.so build/$1/libavcodec && - cp $FFMPEG_DIR/libavutil/*.h $FFMPEG_DIR/libavutil/libavutil.so build/$1/libavutil + cp $FFMPEG_DIR/libavutil/*.h $FFMPEG_DIR/libavutil/libavutil.so build/$1/libavutil || + exit 1 } export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH diff --git a/app/libgocryptfs b/app/libgocryptfs index b232bb7..1da2407 160000 --- a/app/libgocryptfs +++ b/app/libgocryptfs @@ -1 +1 @@ -Subproject commit b232bb782605eb0c6b23aef5f7ea56fd5bd3b7fd +Subproject commit 1da2407a614f17a3c64d14ee34fb41e081db9a71