Skip to content

Commit

Permalink
fixed native binary extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
lhns committed Aug 2, 2021
1 parent 420a0f9 commit cf2c320
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/src/main/java/de/lolhens/resticui/restic/Restic.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.lolhens.resticui.restic

import android.system.Os
import java.io.File
import java.io.InputStream
import java.net.InetAddress
Expand All @@ -12,6 +13,19 @@ class Restic(
private fun executable(name: String) =
storage.lib().resolve("libdata_$name.so")

private val lib = storage.cache().resolve("lib")

private fun initLib(name: String) {
lib.mkdirs()
val linkFile = lib.resolve(name)
linkFile.delete()
Os.symlink(executable(name).absolutePath, linkFile.absolutePath)
}

init {
initLib("libtalloc.so.2")
}

private val proot = executable("proot")
private val restic = executable("restic")
private val loader = executable("loader")
Expand Down Expand Up @@ -39,7 +53,7 @@ class Restic(
private fun vars(): List<Pair<String, String>> = listOf(
Pair("PATH", "/system/bin"),
Pair("TMPDIR", storage.cache().absolutePath),
Pair("LD_LIBRARY_PATH", storage.lib().absolutePath),
Pair("LD_LIBRARY_PATH", lib.absolutePath),
Pair("PROOT_LOADER", loader.absolutePath),
Pair("PROOT_LOADER_32", loader32.absolutePath),
Pair("PROOT_TMP_DIR", storage.cache().absolutePath),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cf2c320

Please sign in to comment.