init+initrd: Create /tmp and mount it on boot
This commit is contained in:
parent
cc72a1655d
commit
0540879959
@ -149,10 +149,28 @@ static Result<void> load_service(const os::Path& path)
|
||||
|
||||
if (parts[0].view() == "Command")
|
||||
{
|
||||
if (!service.command.is_empty())
|
||||
{
|
||||
fprintf(g_init_log, "[init] 'Command' cannot be specified after 'Script' has already been set! (%s)\n",
|
||||
line.chars());
|
||||
return {};
|
||||
}
|
||||
service.command = move(parts[1]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parts[0].view() == "Script")
|
||||
{
|
||||
if (!service.command.is_empty())
|
||||
{
|
||||
fprintf(g_init_log, "[init] 'Script' cannot be specified after 'Command' has already been set! (%s)\n",
|
||||
line.chars());
|
||||
return {};
|
||||
}
|
||||
service.command = TRY(String::format("/bin/sh -- %s"_sv, parts[1].chars()));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (parts[0].view() == "Restart")
|
||||
{
|
||||
if (parts[1].view() == "true" || parts[1].view().to_uint().value_or(0) == 1)
|
||||
@ -210,7 +228,7 @@ static Result<void> load_service(const os::Path& path)
|
||||
|
||||
if (service.command.is_empty())
|
||||
{
|
||||
fprintf(g_init_log, "[init] service file is missing 'Command' entry, aborting!\n");
|
||||
fprintf(g_init_log, "[init] service file is missing 'Command' or 'Script' entry, aborting!\n");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
3
initrd/etc/init/00-tmpfs
Normal file
3
initrd/etc/init/00-tmpfs
Normal file
@ -0,0 +1,3 @@
|
||||
Name=tmpfs
|
||||
Script=/sbin/mount-tmpfs
|
||||
Wait=true
|
3
initrd/sbin/mount-tmpfs
Normal file
3
initrd/sbin/mount-tmpfs
Normal file
@ -0,0 +1,3 @@
|
||||
mkdir -p /tmp
|
||||
mount -t tmpfs /tmp
|
||||
chmod 1777 /tmp
|
Loading…
Reference in New Issue
Block a user