about summary refs log tree commit diff stats
path: root/src/wrapped/wrappedlibc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wrapped/wrappedlibc.c')
-rw-r--r--src/wrapped/wrappedlibc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 742ae677..4fa9ed62 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -1956,6 +1956,19 @@ EXPORT int32_t my_open(x64emu_t* emu, void* pathname, int32_t flags, uint32_t mo
         return -1;
     }
     #endif
+
+    if (!strcmp((const char*)pathname, "box64-custom-bashrc-file")) {
+        int tmp = shm_open("box64-custom-bashrc-file", O_RDWR | O_CREAT, S_IRWXU);
+        if (tmp < 0) return open(pathname, flags, mode); // error fallback
+        shm_unlink("box64-custom-bashrc-file");
+        const char* content = "if [ -f ~/.bashrc ]\nthen\n. ~/.bashrc\nfi\nexport PS1=\"(box64) \"$PS1\nexport BOX64_NOBANNER=1\nexport BOX64_LOG=0\n";
+        size_t dummy;
+        dummy = write(tmp, content, strlen(content));
+        (void)dummy;
+        lseek(tmp, 0, SEEK_SET);
+        return tmp;
+    }
+
     int ret = open(pathname, flags, mode);
     return ret;
 }