auto load rc.tb script
This commit is contained in:
@ -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
|
||||
|
||||
1
base/scripts/mount.tb
Normal file
1
base/scripts/mount.tb
Normal file
@ -0,0 +1 @@
|
||||
print 'Mounting filesystems...\n'
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user