forked from openjdk/jdk27u
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhardcode.patch
More file actions
621 lines (568 loc) · 32.4 KB
/
Copy pathhardcode.patch
File metadata and controls
621 lines (568 loc) · 32.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
From b3425e9b3a1919fd5ea8d427d8bc4a8a36a11e5f Mon Sep 17 00:00:00 2001
From: Henrik Grimler <grimler@termux.dev>
Date: Tue, 6 Jul 2021 18:29:24 +0700
Subject: [PATCH 27/37] Update hardcoded paths to work in termux
---
src/hotspot/os/linux/os_linux.cpp | 10 +++++--
.../share/utilities/virtualizationSupport.cpp | 2 +-
.../classes/sun/nio/fs/LinuxFileSystem.java | 2 +-
.../sun/nio/fs/LinuxFileSystemProvider.java | 2 +-
.../sun/security/jca/ProviderConfig.java | 2 +-
.../net/dns/ResolverConfigurationImpl.java | 2 +-
.../unix/native/libjava/ProcessImpl_md.c | 2 +-
.../unix/native/libjava/TimeZone_md.c | 6 ++--
.../com/sun/java/swing/plaf/gtk/Metacity.java | 11 +++-----
.../com/sun/media/sound/SoftSynthesizer.java | 8 +++---
.../classes/sun/font/SunFontManager.java | 2 +-
.../share/classes/sun/print/PSPrinterJob.java | 4 +--
.../sun/awt/X11/MotifColorUtilities.java | 2 +-
.../sun/print/PrintServiceLookupProvider.java | 28 +++++++++----------
.../unix/classes/sun/print/UnixPrintJob.java | 2 +-
.../classes/sun/print/UnixPrintService.java | 8 +++---
.../unix/native/common/awt/fontpath.c | 25 ++++++++---------
.../util/prefs/FileSystemPreferences.java | 2 +-
.../classes/sun/security/krb5/Config.java | 2 +-
.../internal/ccache/FileCredentialsCache.java | 2 +-
.../security/smartcardio/PlatformPCSC.java | 6 ++--
.../linux/native/libsaproc/symtab.c | 2 +-
.../jpackage/internal/LinuxDebBundler.java | 6 ++--
.../internal/LinuxPackageBundler.java | 4 +--
.../internal/resources/desktop_utils.sh | 2 +-
25 files changed, 73 insertions(+), 71 deletions(-)
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
index f7427caca..d713a8634 100644
--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -1527,7 +1527,13 @@ int os::current_process_id() {
// This must be hard coded because it's the system's temporary
// directory not the java application's temp directory, ala java.io.tmpdir.
-const char* os::get_temp_directory() { return "/tmp"; }
+const char* os::get_temp_directory() {
+#ifndef __ANDROID__
+ return "/tmp";
+#else
+ return "@TERMUX_PREFIX@/tmp";
+#endif
+}
// check if addr is inside libjvm.so
bool os::address_is_in_vm(address addr) {
@@ -2446,7 +2452,7 @@ void os::Linux::print_process_memory_info(outputStream* st) {
}
bool os::Linux::print_ld_preload_file(outputStream* st) {
- return _print_ascii_file("/etc/ld.so.preload", st, nullptr, "/etc/ld.so.preload:");
+ return _print_ascii_file("@TERMUX_PREFIX@/etc/ld.so.preload", st, nullptr, "@TERMUX_PREFIX@/etc/ld.so.preload:");
}
void os::Linux::print_uptime_info(outputStream* st) {
diff --git a/src/hotspot/share/utilities/virtualizationSupport.cpp b/src/hotspot/share/utilities/virtualizationSupport.cpp
index f3031a958..321941838 100644
--- a/src/hotspot/share/utilities/virtualizationSupport.cpp
+++ b/src/hotspot/share/utilities/virtualizationSupport.cpp
@@ -52,7 +52,7 @@ void VirtualizationSupport::initialize() {
// the open-vm-tools have a different guest lib name
// on some distros e.g. SLES12 the open-vm-tools are the default,
// so use the different libname as a fallback
- dlHandle = os::dll_load("/usr/lib64/libguestlib.so.0", ebuf, sizeof ebuf);
+ dlHandle = os::dll_load("@TERMUX_PREFIX@/lib/libguestlib.so.0", ebuf, sizeof ebuf);
}
#endif
if (dlHandle == nullptr) {
diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
index 44e957f54..ddbb02b53 100644
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java
@@ -124,7 +124,7 @@ List<UnixMountEntry> getMountEntries(String fstab) {
*/
@Override
List<UnixMountEntry> getMountEntries() {
- return getMountEntries("/etc/mtab");
+ return getMountEntries("@TERMUX_PREFIX@/etc/mtab");
}
@Override
diff --git a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
index a1c2aed4b..23c7df39c 100644
--- a/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
+++ b/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java
@@ -104,7 +104,7 @@ public <A extends BasicFileAttributes> A readAttributes(Path file,
FileTypeDetector getFileTypeDetector() {
String userHome = StaticProperty.userHome();
Path userMimeTypes = Path.of(userHome, ".mime.types");
- Path etcMimeTypes = Path.of("/etc/mime.types");
+ Path etcMimeTypes = Path.of("@TERMUX_PREFIX@/etc/mime.types");
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
new MimeTypesFileTypeDetector(etcMimeTypes));
diff --git a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
index ce954b3b6..695f2ef44 100644
--- a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
+++ b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
@@ -94,7 +94,7 @@ final class ProviderConfig {
// avoid if not available (pre Solaris 10) to reduce startup time
// or if disabled via system property
private void checkSunPKCS11Solaris() {
- File file = new File("/usr/lib/libpkcs11.so");
+ File file = new File("@TERMUX_PREFIX@/lib/libpkcs11.so");
if (file.exists() == false ||
("false".equalsIgnoreCase(System.getProperty
("sun.security.pkcs11.enable-solaris")))) {
diff --git a/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java b/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
index a466331de..32b3855e9 100644
--- a/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
+++ b/src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java
@@ -64,7 +64,7 @@ private ArrayList<String> resolvconf(String keyword,
try {
BufferedReader in =
- new BufferedReader(new FileReader("/etc/resolv.conf"));
+ new BufferedReader(new FileReader("@TERMUX_PREFIX@/etc/resolv.conf"));
String line;
while ((line = in.readLine()) != null) {
int maxvalues = maxperkeyword;
diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c
index 6a56829a4..8f79b1228 100644
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c
@@ -230,7 +230,7 @@ xmalloc(JNIEnv *env, size_t size)
static const char*
defaultPath(void)
{
- return ":/bin:/usr/bin";
+ return ":@TERMUX_PREFIX@/bin";
}
static const char*
diff --git a/src/java.base/unix/native/libjava/TimeZone_md.c b/src/java.base/unix/native/libjava/TimeZone_md.c
index bc55f099b..48528f435 100644
--- a/src/java.base/unix/native/libjava/TimeZone_md.c
+++ b/src/java.base/unix/native/libjava/TimeZone_md.c
@@ -46,8 +46,8 @@
#define fileclose fclose
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
-static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
-static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
+static const char *ZONEINFO_DIR = "@TERMUX_PREFIX@/share/zoneinfo";
+static const char *DEFAULT_ZONEINFO_FILE = "@TERMUX_PREFIX@/etc/localtime";
#else
static const char *SYS_INIT_FILE = "/etc/default/init";
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
index 629b107f1..d65b51a7a 100644
--- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
+++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java
@@ -515,13 +515,10 @@ public Object getThemeItem(int type, Object arg) {
String[] dirs = new String[] {
userHome + sep + ".themes",
System.getProperty("swing.metacitythemedir"),
- "/usr/X11R6/share/themes",
- "/usr/X11R6/share/gnome/themes",
- "/usr/local/share/themes",
- "/usr/local/share/gnome/themes",
- "/usr/share/themes",
- "/usr/gnome/share/themes", // Debian/Redhat/Solaris
- "/opt/gnome2/share/themes" // SuSE
+ "@TERMUX_PREFIX@/share/themes",
+ "@TERMUX_PREFIX@/share/gnome/themes",
+ "@TERMUX_PREFIX@/local/share/themes",
+ "@TERMUX_PREFIX@/local/share/gnome/themes",
};
URL themeDir = null;
diff --git a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
index 6aaddb3e4..dd76657d0 100644
--- a/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
+++ b/src/java.desktop/share/classes/com/sun/media/sound/SoftSynthesizer.java
@@ -687,11 +687,11 @@ public InputStream run() {
File[] systemSoundFontsDir = new File[] {
/* Arch, Fedora, Mageia */
- new File("/usr/share/soundfonts/"),
- new File("/usr/local/share/soundfonts/"),
+ new File("@TERMUX_PREFIX@/share/soundfonts/"),
+ new File("@TERMUX_PREFIX@/local/share/soundfonts/"),
/* Debian, Gentoo, OpenSUSE, Ubuntu */
- new File("/usr/share/sounds/sf2/"),
- new File("/usr/local/share/sounds/sf2/"),
+ new File("@TERMUX_PREFIX@/share/sounds/sf2/"),
+ new File("@TERMUX_PREFIX@/local/share/sounds/sf2/"),
};
/*
diff --git a/src/java.desktop/share/classes/sun/font/SunFontManager.java b/src/java.desktop/share/classes/sun/font/SunFontManager.java
index 06dc4a908..d5b1c4e15 100644
--- a/src/java.desktop/share/classes/sun/font/SunFontManager.java
+++ b/src/java.desktop/share/classes/sun/font/SunFontManager.java
@@ -3341,7 +3341,7 @@ public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
protected void addNativeFontFamilyNames(TreeMap<String, String> familyNames, Locale requestedLocale) { }
public void register1dot0Fonts() {
- String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
+ String type1Dir = "@TERMUX_PREFIX@/openwin/lib/X11/fonts/Type1";
registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK, false, false);
}
diff --git a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
index a0f68a713..7d6eb1662 100644
--- a/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
+++ b/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
@@ -1597,7 +1597,7 @@ private String[] printExecCmd(String printer, String options,
if (OSInfo.getOSType() == OSInfo.OSType.LINUX ||
OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lpr";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lpr";
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-P" + printer;
}
@@ -1621,7 +1621,7 @@ private String[] printExecCmd(String printer, String options,
} else {
ncomps+=1; //add 1 arg for lp
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lp";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lp";
execCmd[n++] = "-c"; // make a copy of the spool file
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-d" + printer;
diff --git a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
index 664de4910..06eb6f9a3 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11/MotifColorUtilities.java
@@ -410,7 +410,7 @@ static void loadSystemColorsForCDE(int[] systemColors) throws Exception {
if (!pFile.exists())
{
// Must be a system palette
- paletteFilePath = "/usr/dt/palettes/" + paletteFile;
+ paletteFilePath = "@TERMUX_PREFIX@/dt/palettes/" + paletteFile;
pFile = new File(paletteFilePath);
if (!pFile.exists())
{
diff --git a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
index e91ef99ab..15e545fc0 100644
--- a/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
+++ b/src/java.desktop/unix/classes/sun/print/PrintServiceLookupProvider.java
@@ -75,10 +75,10 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
// List of commands used to deal with the printer queues on AIX
String[] lpNameComAix = {
- "/usr/bin/lsallq",
- "/usr/bin/lpstat -W -p|/usr/bin/expand|/usr/bin/cut -f1 -d' '",
- "/usr/bin/lpstat -W -d|/usr/bin/expand|/usr/bin/cut -f1 -d' '",
- "/usr/bin/lpstat -W -v"
+ "@TERMUX_PREFIX@/bin/lsallq",
+ "@TERMUX_PREFIX@/bin/lpstat -W -p|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f1 -d' '",
+ "@TERMUX_PREFIX@/bin/lpstat -W -d|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f1 -d' '",
+ "@TERMUX_PREFIX@/bin/lpstat -W -v"
};
private static final int aix_lsallq = 0;
private static final int aix_lpstat_p = 1;
@@ -159,13 +159,13 @@ static boolean isAIX() {
static int cmdIndex = UNINITIALIZED;
String[] lpcFirstCom = {
- "/usr/sbin/lpc status | grep : | sed -ne '1,1 s/://p'",
- "/usr/sbin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'"
+ "@TERMUX_PREFIX@/bin/lpc status | grep : | sed -ne '1,1 s/://p'",
+ "@TERMUX_PREFIX@/bin/lpc status | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}'"
};
String[] lpcAllCom = {
- "/usr/sbin/lpc status all | grep : | sed -e 's/://'",
- "/usr/sbin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort"
+ "@TERMUX_PREFIX@/bin/lpc status all | grep : | sed -e 's/://'",
+ "@TERMUX_PREFIX@/bin/lpc status all | grep -E '^[ 0-9a-zA-Z_-]*@' | awk -F'@' '{print $1}' | sort"
};
String[] lpcNameCom = {
@@ -175,7 +175,7 @@ static boolean isAIX() {
static int getBSDCommandIndex() {
- String command = "/usr/sbin/lpc status all";
+ String command = "@TERMUX_PREFIX@/bin/lpc status all";
String[] names = execCmd(command);
if ((names == null) || (names.length == 0)) {
@@ -727,7 +727,7 @@ private PrintService getNamedPrinterNameBSD(String name) {
if (cmdIndex == UNINITIALIZED) {
cmdIndex = getBSDCommandIndex();
}
- String command = "/usr/sbin/lpc status " + name + lpcNameCom[cmdIndex];
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + name + lpcNameCom[cmdIndex];
String[] result = execCmd(command);
if (result == null || !(result[0].equals(name))) {
@@ -749,7 +749,7 @@ private String[] getAllPrinterNamesBSD() {
static String getDefaultPrinterNameSysV() {
String defaultPrinter = "lp";
- String command = "/usr/bin/lpstat -d";
+ String command = "@TERMUX_PREFIX@/bin/lpstat -d";
String [] names = execCmd(command);
if (names == null || names.length == 0) {
@@ -771,7 +771,7 @@ static String getDefaultPrinterNameSysV() {
private PrintService getNamedPrinterNameSysV(String name) {
- String command = "/usr/bin/lpstat -v " + name;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -v " + name;
String []result = execCmd(command);
if (result == null || result[0].indexOf("unknown printer") > 0) {
@@ -783,7 +783,7 @@ private PrintService getNamedPrinterNameSysV(String name) {
private String[] getAllPrinterNamesSysV() {
String defaultPrinter = "lp";
- String command = "/usr/bin/lpstat -v|/usr/bin/expand|/usr/bin/cut -f3 -d' ' |/usr/bin/cut -f1 -d':' | /usr/bin/sort";
+ String command = "@TERMUX_PREFIX@/bin/lpstat -v|@TERMUX_PREFIX@/bin/expand|@TERMUX_PREFIX@/bin/cut -f3 -d' ' |@TERMUX_PREFIX@/bin/cut -f1 -d':' | @TERMUX_PREFIX@/bin/sort";
String [] names = execCmd(command);
ArrayList<String> printerNames = new ArrayList<>();
@@ -840,7 +840,7 @@ static String[] execCmd(final String command) {
try {
final String[] cmd = new String[3];
if (isAIX()) {
- cmd[0] = "/usr/bin/sh";
+ cmd[0] = "@TERMUX_PREFIX@/bin/sh";
cmd[1] = "-c";
cmd[2] = "env LC_ALL=C " + command;
} else {
diff --git a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
index b8c455a7d..d0e0b9ee2 100644
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java
@@ -854,7 +854,7 @@ private String[] printExecCmd(String printer, String options,
ncomps+=1;
}
execCmd = new String[ncomps];
- execCmd[n++] = "/usr/bin/lpr";
+ execCmd[n++] = "@TERMUX_PREFIX@/bin/lpr";
if ((pFlags & PRINTER) != 0) {
execCmd[n++] = "-P" + printer;
}
diff --git a/src/java.desktop/unix/classes/sun/print/UnixPrintService.java b/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
index 8185abc60..d6eebe938 100644
--- a/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
+++ b/src/java.desktop/unix/classes/sun/print/UnixPrintService.java
@@ -226,7 +226,7 @@ private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsBSD() {
PrintServiceLookupProvider.getBSDCommandIndex();
}
- String command = "/usr/sbin/lpc status " + printer
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + printer
+ lpcStatusCom[PrintServiceLookupProvider.cmdIndex];
String[] results= PrintServiceLookupProvider.execCmd(command);
@@ -275,7 +275,7 @@ protected static String[] filterPrinterNamesAIX(String[] posPrinters) {
private PrinterIsAcceptingJobs getPrinterIsAcceptingJobsAIX() {
// On AIX there should not be a blank after '-a'.
- String command = "/usr/bin/lpstat -a" + printer;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -a" + printer;
String[] results= PrintServiceLookupProvider.execCmd(command);
// Remove headers and bogus entries added by remote printers.
@@ -331,7 +331,7 @@ private QueuedJobCount getQueuedJobCountBSD() {
}
int qlen = 0;
- String command = "/usr/sbin/lpc status " + printer
+ String command = "@TERMUX_PREFIX@/bin/lpc status " + printer
+ lpcQueueCom[PrintServiceLookupProvider.cmdIndex];
String[] results = PrintServiceLookupProvider.execCmd(command);
@@ -360,7 +360,7 @@ private QueuedJobCount getQueuedJobCountBSD() {
private QueuedJobCount getQueuedJobCountAIX() {
// On AIX there should not be a blank after '-a'.
- String command = "/usr/bin/lpstat -a" + printer;
+ String command = "@TERMUX_PREFIX@/bin/lpstat -a" + printer;
String[] results= PrintServiceLookupProvider.execCmd(command);
// Remove headers and bogus entries added by remote printers.
diff --git a/src/java.desktop/unix/native/common/awt/fontpath.c b/src/java.desktop/unix/native/common/awt/fontpath.c
index 2da0ec032..dcf2d766c 100644
--- a/src/java.desktop/unix/native/common/awt/fontpath.c
+++ b/src/java.desktop/unix/native/common/awt/fontpath.c
@@ -62,19 +62,18 @@ extern Display *awt_display;
* various flavors of Linux
*/
static char *fullLinuxFontPath[] = {
- "/usr/X11R6/lib/X11/fonts/TrueType", /* RH 7.1+ */
- "/usr/X11R6/lib/X11/fonts/truetype", /* SuSE */
- "/usr/X11R6/lib/X11/fonts/tt",
- "/usr/X11R6/lib/X11/fonts/TTF",
- "/usr/X11R6/lib/X11/fonts/OTF", /* RH 9.0 (but empty!) */
- "/usr/share/fonts/ja/TrueType", /* RH 7.2+ */
- "/usr/share/fonts/truetype",
- "/usr/share/fonts/ko/TrueType", /* RH 9.0 */
- "/usr/share/fonts/zh_CN/TrueType", /* RH 9.0 */
- "/usr/share/fonts/zh_TW/TrueType", /* RH 9.0 */
- "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType", /* Debian */
- "/usr/X11R6/lib/X11/fonts/Type1",
- "/usr/share/fonts/default/Type1", /* RH 9.0 */
+ "@TERMUX_PREFIX@/share/fonts/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/truetype",
+ "@TERMUX_PREFIX@/share/fonts/tt",
+ "@TERMUX_PREFIX@/share/fonts/TTF",
+ "@TERMUX_PREFIX@/share/fonts/OTF",
+ "@TERMUX_PREFIX@/share/fonts/ja/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/ko/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/zh_CN/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/zh_TW/TrueType",
+ "@TERMUX_PREFIX@/share/fonts/Type1",
+ "@TERMUX_PREFIX@/share/fonts/default/Type1",
+ "/system/fonts",
NULL, /* terminates the list */
};
#elif defined(_AIX)
diff --git a/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java b/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
index 4f75f4347..b9ff2800f 100644
--- a/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
+++ b/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java
@@ -174,7 +174,7 @@ static Preferences getSystemRoot() {
private static void setupSystemRoot() {
String systemPrefsDirName =
- System.getProperty("java.util.prefs.systemRoot", "/etc/.java");
+ System.getProperty("java.util.prefs.systemRoot", "@TERMUX_PREFIX@/etc/.java");
systemRootDir =
new File(systemPrefsDirName, ".systemPrefs");
// Attempt to create root dir if it does not yet exist.
diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
index c92a10685..584c276d1 100644
--- a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
@@ -908,7 +908,7 @@ private String getNativeFileName() {
} else if (OperatingSystem.isMacOS()) {
name = findMacosConfigFile();
} else {
- name = "/etc/krb5.conf";
+ name = "@TERMUX_PREFIX@/etc/krb5.conf";
}
if (DEBUG != null) {
DEBUG.println("Native config name: " + name);
diff --git a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
index a5b128f71..24a85295c 100644
--- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
+++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
@@ -567,7 +567,7 @@ private static String exec(String c) {
(new InputStreamReader(p.getInputStream(), ISO_8859_1));
String s1;
if ((command.length == 1) &&
- (command[0].equals("/usr/bin/env"))) {
+ (command[0].equals("@TERMUX_PREFIX@/bin/env"))) {
while ((s1 = commandResult.readLine()) != null) {
if (s1.length() >= 11) {
if ((s1.substring(0, 11)).equalsIgnoreCase
diff --git a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
index 93d213bc1..00f817219 100644
--- a/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
+++ b/src/java.smartcardio/unix/classes/sun/security/smartcardio/PlatformPCSC.java
@@ -49,11 +49,11 @@ class PlatformPCSC {
// The architecture templates are for Debian-based systems: https://wiki.debian.org/Multiarch/Tuples
// 32-bit arm differs from the pattern of the rest and has to be specified explicitly
- private static final String[] LIB_TEMPLATES = { "/usr/$LIBISA/libpcsclite.so",
- "/usr/local/$LIBISA/libpcsclite.so",
- "/usr/lib/$ARCH-linux-gnu/libpcsclite.so",
- "/usr/lib/arm-linux-gnueabi/libpcsclite.so",
- "/usr/lib/arm-linux-gnueabihf/libpcsclite.so" };
+ private static final String[] LIB_TEMPLATES = { "@TERMUX_PREFIX@/$LIBISA/libpcsclite.so",
+ "@TERMUX_PREFIX@/local/$LIBISA/libpcsclite.so",
+ "@TERMUX_PREFIX@/lib/$ARCH-linux-gnu/libpcsclite.so",
+ "@TERMUX_PREFIX@/lib/arm-linux-gnueabi/libpcsclite.so",
+ "@TERMUX_PREFIX@/lib/arm-linux-gnueabihf/libpcsclite.so" };
private static final String[] LIB_SUFFIXES = { ".1", ".0", "" };
private static final String PCSC_FRAMEWORK = "/System/Library/Frameworks/PCSC.framework/Versions/Current/PCSC";
diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
index 4cb791111..98918d7ee 100644
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c
@@ -53,7 +53,7 @@ typedef struct symtab {
// should be possible to change this, but in a Java environment there
// is no obvious place to put a user interface to do it. Maybe this
// could be set with an environment variable.
-static const char debug_file_directory[] = "/usr/lib/debug";
+static const char debug_file_directory[] = "@TERMUX_PREFIX@/lib/debug";
/* The CRC used in gnu_debuglink, retrieved from
http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files. */
diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/model/LinuxDebPackage.java b/src/jdk.jpackage/lin
ux/classes/jdk/jpackage/internal/model/LinuxDebPackage.java
index 3a4dc9bf0..9dddd6dce 100644
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/model/LinuxDebPackage.java
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/model/LinuxDebPackage.java
@@ -56,7 +56,7 @@ default String maintainer() {
* @return the relative path to the copyright file of this DEB package
*/
default Optional<Path> relativeCopyrightFilePath() {
- if (isInstallDirInUsrTree() || Path.of("/").resolve(relativeInstallDir()).startsWith("/usr/")) {
+ if (isInstallDirInUsrTree() || Path.of("/").resolve(relativeInstallDir()).startsWith("@TERMUX_PREFIX@/")) {
return Optional.of(Path.of("usr/share/doc/", packageName(), "copyright"));
} else if (!isRuntimeInstaller()) {
return Optional.of(relativeInstallDir().resolve("share/doc/copyright"));
diff --git a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java b/test/jdk/tools/jpackage/helpers/j
dk/jpackage/test/PackageTest.java
index 61e4ccdb4..f2bea239e 100644
--- a/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
+++ b/test/jdk/tools/jpackage/helpers/jdk/jpackage/test/PackageTest.java
@@ -809,15 +809,15 @@ private void verifyRootCountInUnpackedPackage(JPackageCommand cmd,
switch (cmd.packageType()) {
case LINUX_RPM -> {
// License file is in /usr/share/licenses subtree
- roots.add(Path.of("/usr"));
+ roots.add(Path.of("@TERMUX_PREFIX@"));
}
case LINUX_DEB -> {
Path installDir = cmd.appInstallationDirectory();
if (installDir.equals(Path.of("/"))
- || installDir.startsWith("/usr")) {
+ || installDir.startsWith("@TERMUX_PREFIX@")) {
// License file is in /usr/share/doc subtree
- roots.add(Path.of("/usr"));
+ roots.add(Path.of("@TERMUX_PREFIX@"));
}
}
diff --git a/test/jdk/tools/jpackage/share/LicenseTest.java b/test/jdk/tools/jpackage/share/LicenseTest.java
index c9e3c8508..d07e36791 100644
--- a/test/jdk/tools/jpackage/share/LicenseTest.java
+++ b/test/jdk/tools/jpackage/share/LicenseTest.java
@@ -103,22 +103,22 @@ public static void testCommon() {
@Test(ifOS = LINUX)
public static void testLinuxLicenseInUsrTree() {
- testLinuxLicenseInUsrTree("/usr");
+ testLinuxLicenseInUsrTree("@TERMUX_PREFIX@");
}
@Test(ifOS = LINUX)
public static void testLinuxLicenseInUsrTree2() {
- testLinuxLicenseInUsrTree("/usr/local");
+ testLinuxLicenseInUsrTree("@TERMUX_PREFIX@/local");
}
@Test(ifOS = LINUX)
public static void testLinuxLicenseInUsrTree3() {
- testLinuxLicenseInUsrTree("/usr/foo");
+ testLinuxLicenseInUsrTree("@TERMUX_PREFIX@/foo");
}
@Test(ifOS = LINUX)
public static void testLinuxLicenseInUsrTree4() {
- testLinuxLicenseInUsrTree("/usrbuz");
+ testLinuxLicenseInUsrTree("@TERMUX_PREFIX@buz");
}
@Test(ifOS = LINUX)
@@ -177,9 +177,9 @@ private static Path rpmLicenseFile(JPackageCommand cmd) {
private static Path debLicenseFile(JPackageCommand cmd) {
Path installDir = cmd.appInstallationDirectory();
- if (installDir.equals(Path.of("/")) || installDir.startsWith("/usr")) {
+ if (installDir.equals(Path.of("/")) || installDir.startsWith("@TERMUX_PREFIX@")) {
// Package is in '/usr' tree
- return Path.of("/usr/share/doc/", LinuxHelper.getPackageName(cmd),
+ return Path.of("@TERMUX_PREFIX@/share/doc/", LinuxHelper.getPackageName(cmd),
"copyright");
}
diff --git a/test/jdk/tools/jpackage/share/RuntimePackageTest.java b/test/jdk/tools/jpackage/share/RuntimePackageTe
st.java
index 2af6543c2..551e39e2a 100644
--- a/test/jdk/tools/jpackage/share/RuntimePackageTest.java
+++ b/test/jdk/tools/jpackage/share/RuntimePackageTest.java
@@ -86,8 +86,8 @@ public static void test() {
}
@Test(ifOS = LINUX)
- @Parameter("/usr")
- @Parameter("/usr/lib/Java")
+ @Parameter("@TERMUX_PREFIX@")
+ @Parameter("@TERMUX_PREFIX@/lib/Java")
public static void testUsrInstallDir(String installDir) {
init()
.addInitializer(cmd -> cmd.addArguments("--install-dir", installDir))
@@ -153,11 +153,11 @@ private static PackageTest init() {
.forTypes(PackageType.LINUX_DEB)
.addInstallVerifier(cmd -> {
String installDir = cmd.getArgumentValue("--install-dir", () -> "/opt");
- Path copyright = Path.of("/usr/share/doc",
+ Path copyright = Path.of("@TERMUX_PREFIX@/share/doc",
LinuxHelper.getPackageName(cmd), "copyright");
boolean withCopyright = LinuxHelper.getPackageFiles(cmd).anyMatch(
Predicate.isEqual(copyright));
- if (installDir.startsWith("/usr/") || installDir.equals("/usr")) {
+ if (installDir.startsWith("@TERMUX_PREFIX@/") || installDir.equals("@TERMUX_PREFIX@")) {
assertTrue(withCopyright, String.format(
"Check the package delivers [%s] copyright file",
copyright));
diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/desktop_utils.sh b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/desktop_utils.sh
index 7c243b2b5..a1a41b2b2 100644
--- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/desktop_utils.sh
+++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/desktop_utils.sh
@@ -92,7 +92,7 @@ desktop_uninstall_default_mime_handler_0 ()
#
desktop_uninstall_default_mime_handler ()
{
- for f in /usr/share/applications/defaults.list /usr/local/share/applications/defaults.list; do
+ for f in @TERMUX_PREFIX@/share/applications/defaults.list @TERMUX_PREFIX@/local/share/applications/defaults.list; do
desktop_uninstall_default_mime_handler_0 "$f" "$@"
done
}