mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 11:09:05 +03:00
SystemServer: Add per user mode (--user)
System server running in user mode will form the basis of a "session" for login purposes in serenity.
This commit is contained in:
parent
3ad6d87a45
commit
f8fb0359ae
Notes:
sideshowbarker
2024-07-18 02:13:42 +09:00
Author: https://github.com/petelliott Commit: https://github.com/SerenityOS/serenity/commit/f8fb0359ae7 Pull-request: https://github.com/SerenityOS/serenity/pull/10433 Issue: https://github.com/SerenityOS/serenity/issues/1181 Reviewed-by: https://github.com/alimpfard ✅
@ -99,33 +99,6 @@ SocketPermissions=600
|
||||
Priority=low
|
||||
User=anon
|
||||
|
||||
[DesktopPicker.Applet]
|
||||
Priority=low
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[ResourceGraph.Applet]
|
||||
Arguments=--cpu=CPUGraph,#00bb00 --memory=MemoryGraph,#00bbbb
|
||||
Priority=low
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[Audio.Applet]
|
||||
Priority=low
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[Network.Applet]
|
||||
Arguments=--name=Network
|
||||
Priority=low
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[ClipboardHistory.Applet]
|
||||
Priority=low
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[AudioServer]
|
||||
# TODO: It would be nice to make this lazy, but Audio.Applet connects to it immediately on startup anyway.
|
||||
Socket=/tmp/portal/audio
|
||||
@ -134,20 +107,6 @@ KeepAlive=1
|
||||
User=anon
|
||||
BootModes=text,graphical
|
||||
|
||||
[Taskbar]
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[Desktop]
|
||||
Executable=/bin/FileManager
|
||||
Arguments=--desktop
|
||||
KeepAlive=1
|
||||
User=anon
|
||||
|
||||
[Terminal]
|
||||
User=anon
|
||||
WorkingDirectory=/home/anon
|
||||
|
||||
[Shell@tty0]
|
||||
Executable=/bin/Shell
|
||||
StdIO=/dev/tty0
|
||||
@ -203,3 +162,7 @@ BootModes=self-test
|
||||
|
||||
[SpiceAgent]
|
||||
KeepAlive=0
|
||||
|
||||
[SystemServer]
|
||||
Arguments=--user
|
||||
User=anon
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Peter Elliott <pelliott@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@ -8,6 +9,7 @@
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Debug.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/ConfigFile.h>
|
||||
#include <LibCore/DirIterator.h>
|
||||
#include <LibCore/Event.h>
|
||||
@ -456,18 +458,27 @@ static void create_tmp_coredump_directory()
|
||||
umask(old_umask);
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
mount_all_filesystems();
|
||||
prepare_synthetic_filesystems();
|
||||
bool user = false;
|
||||
Core::ArgsParser args_parser;
|
||||
args_parser.add_option(user, "Run in user-mode", "user", 'u');
|
||||
args_parser.parse(argc, argv);
|
||||
|
||||
if (!user) {
|
||||
mount_all_filesystems();
|
||||
prepare_synthetic_filesystems();
|
||||
}
|
||||
|
||||
if (pledge("stdio proc exec tty accept unix rpath wpath cpath chown fattr id sigaction", nullptr) < 0) {
|
||||
perror("pledge");
|
||||
return 1;
|
||||
}
|
||||
|
||||
create_tmp_coredump_directory();
|
||||
parse_boot_mode();
|
||||
if (!user) {
|
||||
create_tmp_coredump_directory();
|
||||
parse_boot_mode();
|
||||
}
|
||||
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
@ -476,7 +487,9 @@ int main(int, char**)
|
||||
// Read our config and instantiate services.
|
||||
// This takes care of setting up sockets.
|
||||
NonnullRefPtrVector<Service> services;
|
||||
auto config = Core::ConfigFile::open_for_system("SystemServer");
|
||||
auto config = (user)
|
||||
? Core::ConfigFile::open_for_app("SystemServer")
|
||||
: Core::ConfigFile::open_for_system("SystemServer");
|
||||
for (auto name : config->groups()) {
|
||||
auto service = Service::construct(*config, name);
|
||||
if (service->is_enabled())
|
||||
|
Loading…
Reference in New Issue
Block a user