|
1 | 1 | const Executor = require("./Executor"); |
2 | 2 |
|
3 | | -/** |
4 | | - * AXS server version tag to be used in downloads. |
5 | | - * @constant {string} |
6 | | - */ |
7 | | -const AXS_VERSION_TAG = "v0.2.5"; |
8 | | - |
9 | 3 | const Terminal = { |
10 | 4 | /** |
11 | 5 | * Starts the AXS environment by writing init scripts and executing the sandbox. |
@@ -117,17 +111,17 @@ const Terminal = { |
117 | 111 | if (arch === "arm64-v8a") { |
118 | 112 | libTalloc = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/arm64/libtalloc.so"; |
119 | 113 | prootUrl = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/arm64/libproot-xed.so"; |
120 | | - axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/download/${AXS_VERSION_TAG}/axs-musl-android-arm64`; |
| 114 | + axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/latest/download/axs-musl-android-arm64`; |
121 | 115 | alpineUrl = "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/aarch64/alpine-minirootfs-3.21.0-aarch64.tar.gz"; |
122 | 116 | } else if (arch === "armeabi-v7a") { |
123 | 117 | libTalloc = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/arm32/libtalloc.so"; |
124 | 118 | prootUrl = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/arm32/libproot-xed.so"; |
125 | | - axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/download/${AXS_VERSION_TAG}/axs-musl-android-armv7`; |
| 119 | + axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/latest/download/axs-musl-android-armv7`; |
126 | 120 | alpineUrl = "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/armhf/alpine-minirootfs-3.21.0-armhf.tar.gz"; |
127 | 121 | } else if (arch === "x86_64") { |
128 | 122 | libTalloc = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/x64/libtalloc.so"; |
129 | 123 | prootUrl = "https://raw.githubusercontent.com/Acode-Foundation/Acode/main/src/plugins/proot/libs/x64/libproot-xed.so"; |
130 | | - axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/download/${AXS_VERSION_TAG}/axs-musl-android-x86_64`; |
| 124 | + axsUrl = `https://github.com/bajrangCoder/acodex_server/releases/latest/download/axs-musl-android-x86_64`; |
131 | 125 | alpineUrl = "https://dl-cdn.alpinelinux.org/alpine/v3.21/releases/x86_64/alpine-minirootfs-3.21.0-x86_64.tar.gz"; |
132 | 126 | } else { |
133 | 127 | throw new Error(`Unsupported architecture: ${arch}`); |
@@ -268,21 +262,21 @@ const Terminal = { |
268 | 262 | reject("Alpine is not installed."); |
269 | 263 | return; |
270 | 264 | } |
271 | | - |
| 265 | + |
272 | 266 | const cmd = ` |
273 | 267 | set -e |
274 | | - |
| 268 | +
|
275 | 269 | INCLUDE_FILES="alpine .downloaded .extracted axs" |
276 | 270 | if [ "$FDROID" = "true" ]; then |
277 | 271 | INCLUDE_FILES="$INCLUDE_FILES libtalloc.so.2 libproot-xed.so" |
278 | 272 | fi |
279 | | - |
| 273 | +
|
280 | 274 | EXCLUDE="--exclude=alpine/data --exclude=alpine/system --exclude=alpine/vendor --exclude=alpine/sdcard --exclude=alpine/storage" |
281 | | - |
| 275 | +
|
282 | 276 | tar -cf "$PREFIX/aterm_backup.tar" -C "$PREFIX" $EXCLUDE $INCLUDE_FILES |
283 | 277 | echo "ok" |
284 | 278 | `; |
285 | | - |
| 279 | + |
286 | 280 | const result = await Executor.execute(cmd); |
287 | 281 | if (result === "ok") { |
288 | 282 | resolve(cordova.file.dataDirectory + "aterm_backup.tar"); |
@@ -314,24 +308,24 @@ const Terminal = { |
314 | 308 | if (await this.isAxsRunning()) { |
315 | 309 | await this.stopAxs(); |
316 | 310 | } |
317 | | - |
| 311 | + |
318 | 312 | const cmd = ` |
319 | 313 | sleep 2 |
320 | | - |
| 314 | +
|
321 | 315 | INCLUDE_FILES="$PREFIX/alpine $PREFIX/.downloaded $PREFIX/.extracted $PREFIX/axs" |
322 | | - |
| 316 | +
|
323 | 317 | if [ "$FDROID" = "true" ]; then |
324 | 318 | INCLUDE_FILES="$INCLUDE_FILES $PREFIX/libtalloc.so.2 $PREFIX/libproot-xed.so" |
325 | 319 | fi |
326 | | - |
| 320 | +
|
327 | 321 | for item in $INCLUDE_FILES; do |
328 | 322 | rm -rf -- "$item" |
329 | 323 | done |
330 | | - |
| 324 | +
|
331 | 325 | tar -xf "$PREFIX/aterm_backup.bin" -C "$PREFIX" |
332 | 326 | echo "ok" |
333 | 327 | `; |
334 | | - |
| 328 | + |
335 | 329 | const result = await Executor.execute(cmd); |
336 | 330 | if (result === "ok") { |
337 | 331 | resolve(result); |
|
0 commit comments