summaryrefslogtreecommitdiff
path: root/usr.sbin/init
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/init')
-rw-r--r--usr.sbin/init/Makefile2
-rw-r--r--usr.sbin/init/main.c21
2 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/init/Makefile b/usr.sbin/init/Makefile
index bee9f3a..5f95379 100644
--- a/usr.sbin/init/Makefile
+++ b/usr.sbin/init/Makefile
@@ -2,5 +2,5 @@ include user.mk
CFILES = $(shell find . -name "*.c")
-init:
+$(ROOT)/base/usr/sbin/init:
gcc $(CFILES) -o $@ $(INTERNAL_CFLAGS)
diff --git a/usr.sbin/init/main.c b/usr.sbin/init/main.c
index 8ef90d3..b5c4fab 100644
--- a/usr.sbin/init/main.c
+++ b/usr.sbin/init/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora Team.
+ * Copyright (c) 2023-2025 Ian Marco Moffett and the Osmora Team.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,8 +27,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/spawn.h>
+#include <stddef.h>
+
+#define SHELL_PATH "/usr/bin/osh"
+#define LOGIN_PATH "/usr/bin/login"
+#define INIT_RC_PATH "/usr/rc/init.rc"
+
int
-main(void)
+main(int argc, char **argv)
{
+ char *login_argv[] = { LOGIN_PATH, NULL };
+ char *start_argv[] = { SHELL_PATH, INIT_RC_PATH, NULL };
+ char *envp[] = { NULL };
+
+ /* Start the init.rc */
+ spawn(SHELL_PATH, start_argv, envp, 0);
+ start_argv[1] = NULL;
+
+ /* Start the login manager */
+ spawn(login_argv[0], login_argv, envp, SPAWN_WAIT);
return 0;
}