Skip to content

Commit 42618ca

Browse files
committed
Add env var SHARUN_PRINTENV=1 Print environment variables to stderr (sharun)
Add env var XTABLES_LIBDIR for ${SHARUN_DIR}/shared/$LIB/xtables (sharun) Set env var FONTCONFIG_FILE if no /etc/fonts/fonts.conf (sharun)
1 parent 1128458 commit 42618ca

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sharun"
3-
version = "0.6.3"
3+
version = "0.6.4"
44
readme = "README.md"
55
license = "MIT"
66
repository = "https://github.com/VHSgunzo/sharun"

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ cp ./target/$(uname -m)-unknown-linux-musl/release/sharun .
4747
SHARUN_WORKING_DIR=/path Specifies the path to the working directory
4848
SHARUN_ALLOW_SYS_VKICD=1 Enables breaking system vulkan/icd.d for vulkan loader
4949
SHARUN_ALLOW_LD_PRELOAD=1 Enables breaking LD_PRELOAD env variable
50+
SHARUN_PRINTENV=1 Print environment variables to stderr
5051
SHARUN_LDNAME=ld.so Specifies the name of the interpreter
5152
SHARUN_DIR Sharun directory
5253
```
@@ -184,6 +185,7 @@ This can be useful, for example, to use [ld-preload-open](https://github.com/fri
184185
|`PIPEWIRE_MODULE_DIR` | `${SHARUN_DIR}/shared/$LIB/pipewire-*`|
185186
|`GI_TYPELIB_PATH` | `${SHARUN_DIR}/shared/$LIB/girepository-*`|
186187
|`GBM_BACKENDS_PATH` | `${SHARUN_DIR}/shared/$LIB/gbm`|
188+
|`XTABLES_LIBDIR` | `${SHARUN_DIR}/shared/$LIB/xtables`|
187189
|||
188190
|---|---|
189191
|`XDG_DATA_DIRS` | `${SHARUN_DIR}/share`|
@@ -196,7 +198,7 @@ This can be useful, for example, to use [ld-preload-open](https://github.com/fri
196198
|`LIBTHAI_DICTDIR` | `${SHARUN_DIR}/share/libthai/thbrk.tri`|
197199
|||
198200
|---|---|
199-
|`FONTCONFIG_FILE` | `${SHARUN_DIR}/etc/fonts/fonts.conf`|
201+
|`FONTCONFIG_FILE` (if no /etc/fonts/fonts.conf) | `${SHARUN_DIR}/etc/fonts/fonts.conf`|
200202

201203
## Projects that use sharun:
202204
* [SoarPkgs](https://github.com/pkgforge/soarpkgs)

src/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ fn print_usage() {
372372
SHARUN_WORKING_DIR=/path Specifies the path to the working directory
373373
SHARUN_ALLOW_SYS_VKICD=1 Enables breaking system vulkan/icd.d for vulkan loader
374374
SHARUN_ALLOW_LD_PRELOAD=1 Enables breaking LD_PRELOAD env variable
375+
SHARUN_PRINTENV=1 Print environment variables to stderr
375376
SHARUN_LDNAME=ld.so Specifies the name of the interpreter
376377
SHARUN_DIR Sharun directory");
377378
}
@@ -692,6 +693,9 @@ fn main() {
692693
if dir == "gbm" {
693694
env::set_var("GBM_BACKENDS_PATH", dir_path)
694695
}
696+
if dir == "xtables" {
697+
env::set_var("XTABLES_LIBDIR", dir_path)
698+
}
695699
if dir.starts_with("spa-") {
696700
env::set_var("SPA_PLUGIN_DIR", dir_path)
697701
}
@@ -850,7 +854,7 @@ fn main() {
850854
match name.to_str().unwrap() {
851855
"fonts" => {
852856
let fonts_conf = entry_path.join("fonts.conf");
853-
if fonts_conf.exists() {
857+
if !Path::new("/etc/fonts/fonts.conf").exists() && fonts_conf.exists() {
854858
env::set_var("FONTCONFIG_FILE", fonts_conf)
855859
}
856860
}
@@ -880,6 +884,13 @@ fn main() {
880884
env::remove_var(var_name)
881885
}
882886

887+
if get_env_var("SHARUN_PRINTENV") == "1" {
888+
env::remove_var("SHARUN_PRINTENV");
889+
for (k, v) in env::vars() {
890+
eprintln!("{k}={v}")
891+
}
892+
}
893+
883894
cfg_if! {
884895
if #[cfg(feature = "pyinstaller")] {
885896
let is_pyinstaller_elf = is_elf_section(&elf_bytes, "pydata").unwrap_or(false);

0 commit comments

Comments
 (0)