The shell is now spawned as a boot service

This commit is contained in:
Nocturn9x 2021-12-09 17:30:30 +01:00
parent fd35755da5
commit 9289c455e3
3 changed files with 7 additions and 2 deletions

View File

@ -29,7 +29,6 @@ proc mainLoop*(logger: Logger) =
logger.info("System initialization complete, going idle")
logger.switchToFile()
try:
discard execShellCmd("/bin/login -f root") # TODO: Use a service
while true:
sleepSeconds(30)
except:

View File

@ -292,7 +292,7 @@ proc startService(logger: Logger, service: Service) =
var arguments = split.words
let progName = arguments[0]
arguments = arguments[1..^1]
process = startProcess(progName, workingDir=service.workDir, args=arguments)
process = startProcess(progName, workingDir=service.workDir, args=arguments, options={poParentStreams})
if service.supervised and service.kind != Oneshot:
var pid = posix.fork()
if pid == 0:

View File

@ -59,10 +59,16 @@ proc addStuff =
exec="/bin/true", supervised=true, restart=Always,
restartDelay=5, runlevel=Boot, workDir="/", kind=Simple,
depends=(@[newDependency(Other, errorer)]), provides=(@[]))
var shell = newService(name="login", description="A simple login shell", kind=Simple,
getCurrentDir(), runlevel=Boot, exec="/bin/login -f root",
supervised=true, restart=Always, restartDelay=0, depends=(@[]), provides=(@[])
)
addService(errorer)
addService(echoer)
addService(exiter)
addService(test)
addService(shell)
proc main(logger: Logger, mountDisks: bool = true, fstab: string = "/etc/fstab", setHostname: bool = true, workerCount: int = 1) =