mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-12-16 22:11:14 +01:00
Set executable bits for files in EXECUTABLES.txt
Partial reimplementation of d3d8aebd1c.
This commit is contained in:
parent
1e0bd6148d
commit
072369e283
1 changed files with 20 additions and 0 deletions
|
|
@ -183,6 +183,7 @@ final class TermuxInstaller {
|
||||||
|
|
||||||
final byte[] buffer = new byte[8096];
|
final byte[] buffer = new byte[8096];
|
||||||
final List<Pair<String, String>> symlinks = new ArrayList<>(50);
|
final List<Pair<String, String>> symlinks = new ArrayList<>(50);
|
||||||
|
final List<String> executables = new ArrayList<>(128);
|
||||||
|
|
||||||
final URL zipUrl = determineZipUrl(bootstrapURL);
|
final URL zipUrl = determineZipUrl(bootstrapURL);
|
||||||
try (ZipInputStream zipInput = new ZipInputStream(zipUrl.openStream())) {
|
try (ZipInputStream zipInput = new ZipInputStream(zipUrl.openStream())) {
|
||||||
|
|
@ -205,6 +206,12 @@ final class TermuxInstaller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (zipEntry.getName().equals("EXECUTABLES.txt")) {
|
||||||
|
BufferedReader executablesReader = new BufferedReader(new InputStreamReader(zipInput));
|
||||||
|
String line;
|
||||||
|
while ((line = executablesReader.readLine()) != null) {
|
||||||
|
executables.add(line);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
String zipEntryName = zipEntry.getName();
|
String zipEntryName = zipEntry.getName();
|
||||||
File targetFile = new File(TERMUX_STAGING_PREFIX_DIR_PATH, zipEntryName);
|
File targetFile = new File(TERMUX_STAGING_PREFIX_DIR_PATH, zipEntryName);
|
||||||
|
|
@ -232,6 +239,19 @@ final class TermuxInstaller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!executables.isEmpty()) {
|
||||||
|
for (String executable : executables) {
|
||||||
|
//noinspection OctalInteger
|
||||||
|
try {
|
||||||
|
Os.chmod(TERMUX_STAGING_PREFIX_DIR + "/" + executable, 0700);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
Logger.logError(LOG_TAG, "EXECUTABLES error: " + TERMUX_STAGING_PREFIX_DIR + "/" + executable + t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Installer: no EXECUTABLES.txt found while extracting environment archive.");
|
||||||
|
}
|
||||||
|
|
||||||
if (symlinks.isEmpty())
|
if (symlinks.isEmpty())
|
||||||
throw new RuntimeException("No SYMLINKS.txt encountered");
|
throw new RuntimeException("No SYMLINKS.txt encountered");
|
||||||
for (Pair<String, String> symlink : symlinks) {
|
for (Pair<String, String> symlink : symlinks) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue