From 5aebc61c06270c99eb646ba59d14b3e521f0e5bf Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 12 Oct 2025 14:13:22 +0200 Subject: [PATCH] auto load rc.tb script --- base/scripts/init.tb | 7 ++++--- base/scripts/mount.tb | 1 + user/init/main.c | 2 +- user/tb/main.c | 7 +------ user/tb/runtime.c | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 base/scripts/mount.tb diff --git a/base/scripts/init.tb b/base/scripts/init.tb index 8554f13..70ce92f 100644 --- a/base/scripts/init.tb +++ b/base/scripts/init.tb @@ -1,3 +1,4 @@ -print 'this is an init script!' -base:/bin/pctl ls -base:/bin/tb -m interactive -preload base:/scripts/rc.tb +print 'this is an init script!\n' +$tb -m runfile -f base:/scripts/mount.tb +$pctl ls +$tb -m interactive diff --git a/base/scripts/mount.tb b/base/scripts/mount.tb new file mode 100644 index 0000000..4a95daf --- /dev/null +++ b/base/scripts/mount.tb @@ -0,0 +1 @@ +print 'Mounting filesystems...\n' diff --git a/user/init/main.c b/user/init/main.c index 90f2d7d..00fab3a 100644 --- a/user/init/main.c +++ b/user/init/main.c @@ -8,7 +8,7 @@ Dev_t termdev; void tb_runinitscript(void) { devctl(&termdev, DEVCTL_GET_HANDLE, (uint8_t *)"termdev", 0, 0); - char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb", "-logcmds", "yes" }; + char *tbargs[] = { "-m", "runfile", "-f", "base:/scripts/init.tb" }; int32_t tb = processctl(-1, PCTL_SPAWN, (uint64_t)"base:/bin/tb", (uint64_t)(char **)tbargs, ARRLEN(tbargs)); processctl(tb, PCTL_RUN, 0, 0, 0); diff --git a/user/tb/main.c b/user/tb/main.c index b16c5e7..c4c29f5 100644 --- a/user/tb/main.c +++ b/user/tb/main.c @@ -21,8 +21,6 @@ struct { bool logcmds; - char *preloadpath; - char *runstring; } CONFIG; @@ -30,7 +28,6 @@ static Arg ARGS[] = { ARG("-m", ARG_STRING, &CONFIG.modestr), ARG("-f", ARG_STRING, &CONFIG.filepath), ARG("-logcmds", ARG_BOOL, &CONFIG.logcmds), - ARG("-preload", ARG_STRING, &CONFIG.preloadpath), ARG("-rs", ARG_STRING, &CONFIG.runstring), ARG_END(), }; @@ -153,9 +150,7 @@ void main(void) { set_config(); - if (CONFIG.preloadpath != NULL) { - do_file(CONFIG.preloadpath); - } + do_file("base:/scripts/rc.tb"); if (CONFIG.mode == MODE_INTERACTIVE) { devctl(&ps2kbdev, DEVCTL_GET_HANDLE, (uint8_t *)"ps2kbdev", 0, 0); diff --git a/user/tb/runtime.c b/user/tb/runtime.c index eab552a..666b1f6 100644 --- a/user/tb/runtime.c +++ b/user/tb/runtime.c @@ -86,7 +86,7 @@ bool rt_PID(Token *tks) { bool rt_do(Token *tks) { bool ok = true; - char *prepended_args[] = { "-m", "runstring", "-preload", "base:/scripts/rc.tb", "-rs" }; + char *prepended_args[] = { "-m", "runstring", "-rs" }; #define SUBSH_MAX_STRING PROC_ARG_MAX char *s = umalloc(SUBSH_MAX_STRING);