Installing all types of packages

This commit is contained in:
Andrii Dokhniak 2025-04-09 14:48:21 +02:00
parent 18541a6647
commit 24890e9a4c
6 changed files with 16 additions and 65 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
set -e
# -r to replace an existing application if any
/opt/android-sdk-linux/platform-tools/adb install -r /shared_buffer/app.apk
/opt/android-sdk-linux/platform-tools/adb install-multiple -r /shared_buffer/*.apk

View File

@ -148,7 +148,7 @@
</div>
<form id="upload_form" hx-post="/upload_apk" enctype="multipart/form-data" hx-target="#resp">
<label id="upload_input" for="app">Select file
<input type="file" id="app" name="app" accept=".apk" required/>
<input type="file" id="app" name="app" accept=".apk" required multiple/>
</label>
<button type="submit">Install the app</button>
</form>

View File

@ -6,6 +6,8 @@ import {
waitFullBoot,
} from "./screenshot.mjs";
import { execSync } from 'node:child_process';
import fileUpload from 'express-fileupload';
const device_size_x = 320;
@ -62,19 +64,18 @@ app.post("/back", function (req, res) {
// default options
app.use(fileUpload());
app.post('/upload_apk',function (req, res) {
app.post('/upload_apk', async function (req, res) {
if (!req.files || Object.keys(req.files).length === 0) {
return res.status(400).send('No files were uploaded.');
}
let file = req.files.app;
let uploadPath = '/shared_buffer/app.apk';
file.mv(uploadPath, function(err) {
if (err)
return res.status(500).send(err);
execSync("rm -rf /shared_buffer/*");
console.log(req.files);
for (const [idx, file] of req.files.app.entries()) {
let uploadPath = '/shared_buffer/app' + idx + '.apk';
await file.mv(uploadPath);
}
android_websocket.send(`install`);
res.send('File uploaded!');
});
res.send('Files uploaded!');
})
app.post("/home", function (req, res) {

View File

@ -2,9 +2,8 @@ FROM runmymind/docker-android-sdk:ubuntu-standalone-20230511
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/android-sdk-linux/cmdline-tools/latest/bin:/opt/android-sdk-linux/cmdline-tools/tools/bin:/opt/android-sdk-linux/tools/bin:/opt/android-sdk-linux/build-tools/32.0.0:/opt/android-sdk-linux/platform-tools:/opt/android-sdk-linux/emulator:/opt/android-sdk-linux/bin
RUN sdkmanager "system-images;android-33;google_apis;x86_64"
RUN echo no | avdmanager create avd -n virtual_dev -b google_apis/x86_64 -k "system-images;android-33;google_apis;x86_64"
RUN apt-get update && apt-get install -y iproute2 iputils-ping iptables redsocks npm git
RUN sdkmanager --channel=2 "system-images;android-30;google_apis;x86_64" \
&& echo no | avdmanager create avd -n virtual_dev -b google_apis/x86_64 -k "system-images;android-30;google_apis;x86_64" \
&& apt-get update && apt-get install -y iproute2 iputils-ping npm git
CMD bash /preconf/docker-entrypoint.sh

View File

@ -1,9 +1,5 @@
hashed_name=`openssl x509 -inform PEM -subject_hash_old -in /ca-cert.pem | head -1`
adb start-server
emulator -avd virtual_dev -writable-system -no-window -no-audio &
cp /ca-cert.pem /$hashed_name.0
bash /preconf/install_cert.sh $hashed_name.0
bash /preconf/install_culebra.sh
adb emu avd snapshot save configured

View File

@ -1,45 +0,0 @@
wait-for-offline() {
while [ $(adb devices | grep offline | wc -l) -eq 0 ]; do
sleep 0.1
done
}
adb wait-for-device
adb root
wait-for-offline
adb wait-for-device
adb shell avbctl disable-verification
#here may be the issue with the bypass (start)
adb wait-for-device
adb reboot
adb wait-for-device
adb root
#(end)
wait-for-offline
adb wait-for-device
adb remount
adb wait-for-device
adb reboot
adb wait-for-device
adb root
wait-for-offline
adb wait-for-device
adb remount
adb wait-for-device
adb push /$1 /system/etc/security/cacerts
adb shell chmod 664 /system/etc/security/cacerts/$1
adb reboot
#wait for complete boot
adb wait-for-device
while [ "$(adb shell getprop sys.boot_completed | tr -d '\r')" != "1" ]; do
sleep 1
done