mirror of
https://github.com/liberatedsystems/Sideband_CE.git
synced 2024-09-03 04:13:27 +02:00
Merge pull request #1 from liberatedsystems/docker
Add docker build files
This commit is contained in:
commit
5c73f8cea8
1
.gitignore
vendored
1
.gitignore
vendored
@ -32,3 +32,4 @@ dist
|
|||||||
docs/build
|
docs/build
|
||||||
sideband*.egg-info
|
sideband*.egg-info
|
||||||
sbapp*.egg-info
|
sbapp*.egg-info
|
||||||
|
key.keystore
|
||||||
|
65
Dockerfile
Normal file
65
Dockerfile
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
FROM ubuntu:22.04 as build
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get update \
|
||||||
|
&& DEBIAN_FRONTEND=noninteractive apt-get install -y git libffi-dev python3-dev python3-virtualenv libssl-dev autoconf openjdk-17-jdk cmake libtool libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev unzip zip wget apksigner \
|
||||||
|
&& apt-get install --reinstall python3
|
||||||
|
|
||||||
|
WORKDIR "/root"
|
||||||
|
|
||||||
|
# Copy Sideband
|
||||||
|
COPY ./ Sideband/
|
||||||
|
|
||||||
|
# Copy gradle init file
|
||||||
|
COPY docker/init.gradle .gradle/
|
||||||
|
|
||||||
|
# Clone required repos
|
||||||
|
RUN git clone https://github.com/markqvist/Reticulum \
|
||||||
|
&& git clone https://github.com/markqvist/LXMF
|
||||||
|
|
||||||
|
# Fetch files required for sideband local repository
|
||||||
|
|
||||||
|
RUN mkdir dist_archive
|
||||||
|
|
||||||
|
WORKDIR "dist_archive"
|
||||||
|
|
||||||
|
# Get latest version of whl packages from PyPI
|
||||||
|
COPY docker/dist_env .
|
||||||
|
|
||||||
|
RUN export PACKAGENAME=rns; . ./dist_env; wget --content-disposition -q ${DL_URL}; \
|
||||||
|
export PACKAGENAME=rnspure; . ./dist_env; wget --content-disposition -q ${DL_URL}; \
|
||||||
|
export PACKAGENAME=lxmf; . ./dist_env; wget --content-disposition -q ${DL_URL}; \
|
||||||
|
export PACKAGENAME=nomadnet; . ./dist_env; wget --content-disposition -q ${DL_URL}; \
|
||||||
|
export PACKAGENAME=rnsh; . ./dist_env; wget --content-disposition -q ${DL_URL}; \
|
||||||
|
export PACKAGENAME=sbapp; . ./dist_env; wget --content-disposition -q ${DL_URL};
|
||||||
|
|
||||||
|
# Get latest RNode Firmware release
|
||||||
|
RUN export VERSION=$(wget -qO - https://api.github.com/repos/markqvist/RNode_Firmware/releases/latest | grep "zipball_url" | grep -oP "\d+\.\d+"); \
|
||||||
|
wget -qO - https://api.github.com/repos/markqvist/RNode_Firmware/releases/latest \
|
||||||
|
| grep "zipball_url" | cut -d : -f 2,3 \
|
||||||
|
| tr -d \", | wget -qi - -O RNode_Firmware_${VERSION}_Source.zip
|
||||||
|
|
||||||
|
# Get source for reticulum.network and unsigned.io sites
|
||||||
|
RUN git clone https://github.com/markqvist/reticulum_website reticulum.network \
|
||||||
|
&& cp reticulum.network/docs/manual/Reticulum\ Manual.pdf . \
|
||||||
|
&& cp reticulum.network/docs/manual/Reticulum\ Manual.epub .
|
||||||
|
|
||||||
|
# A mirror can also be accessed at https://liberatedsystems.co.uk/unsigned_io_archive.zip if unsigned.io is down!
|
||||||
|
RUN wget -q https://unsigned.io/unsigned_io_archive.zip \
|
||||||
|
&& unzip -q unsigned_io_archive.zip -d unsigned.io && rm unsigned_io_archive.zip
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR "../Sideband/sbapp"
|
||||||
|
|
||||||
|
# Set up virtual environment
|
||||||
|
RUN virtualenv venv
|
||||||
|
|
||||||
|
RUN bash -c "source venv/bin/activate && pip install -U pip && pip install setuptools==60.5 wheel==0.30 buildozer cython"
|
||||||
|
|
||||||
|
WORKDIR "../"
|
||||||
|
|
||||||
|
RUN bash -c "make release"
|
||||||
|
|
||||||
|
FROM scratch as artifact
|
||||||
|
COPY --from=build /root/Sideband/dist/* /
|
20
Makefile
20
Makefile
@ -6,7 +6,7 @@ apk:
|
|||||||
mkdir -p ./dist
|
mkdir -p ./dist
|
||||||
|
|
||||||
fetchapk:
|
fetchapk:
|
||||||
cp ./sbapp/bin/sideband-*-release.apk ./dist/
|
cp ./sbapp/bin/sideband-*-release-unsigned.apk ./dist/
|
||||||
|
|
||||||
install:
|
install:
|
||||||
make -C sbapp install
|
make -C sbapp install
|
||||||
@ -33,6 +33,24 @@ build_wheel:
|
|||||||
|
|
||||||
release: build_wheel apk fetchapk
|
release: build_wheel apk fetchapk
|
||||||
|
|
||||||
|
release_docker:
|
||||||
|
-mkdir -p ./dist
|
||||||
|
@echo If you experience errors, please ensure you have docker-buildx installed on your system.
|
||||||
|
sudo docker build --target=artifact --output type=local,dest=./dist/ .
|
||||||
|
@echo Build successful. APK copied to ./dist directory.
|
||||||
|
$(MAKE) sign_release
|
||||||
|
|
||||||
|
sign_release:
|
||||||
|
@echo This stage generates a keystore in the root directory of the repo and signs the APK with it.
|
||||||
|
@echo If a keystore already exists, it is reused.
|
||||||
|
@echo Please make sure you have apksigner and zipalign installed on your system before proceeding.
|
||||||
|
@echo Press enter to continue.
|
||||||
|
@read VOID
|
||||||
|
if [ ! -f "./key.keystore" ]; then keytool -genkey -v -keystore key.keystore -keyalg RSA -keysize 4096 -validity 10000 -alias app; fi
|
||||||
|
VERSION=$(shell ls ./dist/*.apk | cut -d\- -f 2 | head -n 1); \
|
||||||
|
zipalign -p 4 ./dist/sideband-*-release-unsigned.apk ./dist/sideband-$$VERSION-release.apk; \
|
||||||
|
apksigner sign --ks-key-alias app --ks key.keystore ./dist/sideband-$$VERSION-release.apk; \
|
||||||
|
|
||||||
upload:
|
upload:
|
||||||
@echo Ready to publish release, hit enter to continue
|
@echo Ready to publish release, hit enter to continue
|
||||||
@read VOID
|
@read VOID
|
||||||
|
2
docker/dist_env
Normal file
2
docker/dist_env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export VERSION=$(wget -q https://pypi.org/pypi/${PACKAGENAME}/json -O - | grep -oP "\"version\":\"\d+\.\d+\.+\d+\"" -o | cut -d \" -f 4)
|
||||||
|
export DL_URL=$(wget -q https://pypi.org/pypi/${PACKAGENAME}/json -O - | grep -oP "\"url\":\".{1,150}${VERSION}-py\d-none-any.whl\"" | cut -d \" -f 4 | head -n -1)
|
21
docker/init.gradle
Normal file
21
docker/init.gradle
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// This is necessary to ensure that Sideband can be built on the
|
||||||
|
// correct API version. Else, the build will fail, with the build tools
|
||||||
|
// nagging us to upgrade the targetSdkVersion (doing so breaks the
|
||||||
|
// program currently). Yet another case of G**gle foolishness. This
|
||||||
|
// just bypasses the error and continues compiling regardless.
|
||||||
|
|
||||||
|
apply plugin: DisableAbortOnError
|
||||||
|
|
||||||
|
class DisableAbortOnError implements Plugin<Gradle> {
|
||||||
|
void apply (Gradle gradle) {
|
||||||
|
gradle.allprojects { project ->
|
||||||
|
afterEvaluate {
|
||||||
|
android {
|
||||||
|
lintOptions {
|
||||||
|
abortOnError = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
all: prepare debug
|
all: prepare debug
|
||||||
|
|
||||||
prepare: activate cleanrns getrns
|
prepare: cleanrns getrns
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo Cleaning...
|
@echo Cleaning...
|
||||||
@ -11,13 +11,10 @@ clean:
|
|||||||
-(rm ./bin -r)
|
-(rm ./bin -r)
|
||||||
|
|
||||||
cleanlibs:
|
cleanlibs:
|
||||||
buildozer android clean
|
. venv/bin/activate; buildozer android clean
|
||||||
|
|
||||||
cleanall: clean cleanlibs
|
cleanall: clean cleanlibs
|
||||||
|
|
||||||
activate:
|
|
||||||
(. venv/bin/activate)
|
|
||||||
|
|
||||||
pacthfiles: patchsdl injectxml
|
pacthfiles: patchsdl injectxml
|
||||||
|
|
||||||
patchsdl:
|
patchsdl:
|
||||||
@ -42,7 +39,7 @@ injectxml:
|
|||||||
cp patches/p4a_build.py .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/sideband/build.py
|
cp patches/p4a_build.py .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/sideband/build.py
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
buildozer android debug
|
. venv/bin/activate; buildozer android debug
|
||||||
|
|
||||||
prebake:
|
prebake:
|
||||||
ifneq (,$(wildcard .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/sideband/src/main/res/xml/device_filter.xml))
|
ifneq (,$(wildcard .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists/sideband/src/main/res/xml/device_filter.xml))
|
||||||
@ -50,7 +47,7 @@ ifneq (,$(wildcard .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/dists
|
|||||||
else
|
else
|
||||||
@(echo Prebaking build before patching files...)
|
@(echo Prebaking build before patching files...)
|
||||||
@(sleep 2)
|
@(sleep 2)
|
||||||
-(buildozer android release)
|
-(. venv/bin/activate; buildozer android release)
|
||||||
@(echo Prebake finished, applying patches and rebuilding...)
|
@(echo Prebake finished, applying patches and rebuilding...)
|
||||||
@(sleep 2)
|
@(sleep 2)
|
||||||
endif
|
endif
|
||||||
@ -58,6 +55,8 @@ endif
|
|||||||
fetchshare:
|
fetchshare:
|
||||||
-(rm ./share/pkg/*)
|
-(rm ./share/pkg/*)
|
||||||
-(rm ./share/mirrors/* -r)
|
-(rm ./share/mirrors/* -r)
|
||||||
|
if [ ! -d "./share/pkg" ]; then mkdir ./share/pkg; fi
|
||||||
|
if [ ! -d "./share/mirrors" ]; then mkdir ./share/mirrors; fi
|
||||||
cp ../../dist_archive/rns-*-py3-none-any.whl ./share/pkg/
|
cp ../../dist_archive/rns-*-py3-none-any.whl ./share/pkg/
|
||||||
cp ../../dist_archive/rnspure-*-py3-none-any.whl ./share/pkg/
|
cp ../../dist_archive/rnspure-*-py3-none-any.whl ./share/pkg/
|
||||||
cp ../../dist_archive/lxmf-*-py3-none-any.whl ./share/pkg/
|
cp ../../dist_archive/lxmf-*-py3-none-any.whl ./share/pkg/
|
||||||
@ -72,7 +71,7 @@ fetchshare:
|
|||||||
cp ../../dist_archive/Reticulum\ Manual.epub ./share/mirrors/Reticulum_Manual.epub
|
cp ../../dist_archive/Reticulum\ Manual.epub ./share/mirrors/Reticulum_Manual.epub
|
||||||
|
|
||||||
release:
|
release:
|
||||||
buildozer android release
|
. venv/bin/activate; buildozer android release
|
||||||
|
|
||||||
postbuild:
|
postbuild:
|
||||||
$(MAKE) cleanrns
|
$(MAKE) cleanrns
|
||||||
@ -91,9 +90,11 @@ console:
|
|||||||
(adb logcat | grep "python\|sidebandservice")
|
(adb logcat | grep "python\|sidebandservice")
|
||||||
|
|
||||||
getrns:
|
getrns:
|
||||||
(cp -rv ../../Reticulum/RNS ./;rm ./RNS/Utilities/RNS)
|
(cp -rv ../../Reticulum/RNS ./)
|
||||||
|
-(rm ./RNS/Utilities/RNS)
|
||||||
-(rm ./RNS/__pycache__ -r)
|
-(rm ./RNS/__pycache__ -r)
|
||||||
(cp -rv ../../LXMF/LXMF ./;rm ./LXMF/Utilities/LXMF)
|
(cp -rv ../../LXMF/LXMF ./)
|
||||||
|
-(rm ./LXMF/Utilities/LXMF)
|
||||||
-(rm ./LXMF/__pycache__ -r)
|
-(rm ./LXMF/__pycache__ -r)
|
||||||
|
|
||||||
cleanrns:
|
cleanrns:
|
||||||
|
@ -39,6 +39,8 @@ android.release_artifact = apk
|
|||||||
android.archs = arm64-v8a,armeabi-v7a
|
android.archs = arm64-v8a,armeabi-v7a
|
||||||
#android.logcat_filters = *:S python:D
|
#android.logcat_filters = *:S python:D
|
||||||
|
|
||||||
|
android.add_gradle_repositories = flatDir { dirs("../../../../../../patches") }
|
||||||
|
|
||||||
services = sidebandservice:services/sidebandservice.py:foreground
|
services = sidebandservice:services/sidebandservice.py:foreground
|
||||||
android.whitelist = lib-dynload/termios.so
|
android.whitelist = lib-dynload/termios.so
|
||||||
android.manifest.intent_filters = patches/intent-filter.xml
|
android.manifest.intent_filters = patches/intent-filter.xml
|
||||||
|
Loading…
Reference in New Issue
Block a user