diff --git a/Base/etc/SystemServer.ini b/Base/etc/SystemServer.ini index c33bcd742d..d81a5ccd41 100644 --- a/Base/etc/SystemServer.ini +++ b/Base/etc/SystemServer.ini @@ -1,8 +1,3 @@ -[TTYServer] -# NOTE: We don't start anything on tty0 since that's the "active" TTY while WindowServer is up. -Arguments=tty1 -StdIO=/dev/tty1 - [ProtocolServer] Socket=/tmp/portal/protocol SocketPermissions=660 @@ -10,6 +5,7 @@ Lazy=1 Priority=low KeepAlive=1 User=protocol +BootModes=text,graphical [LookupServer] Socket=/tmp/portal/lookup @@ -18,11 +14,13 @@ Lazy=1 Priority=low KeepAlive=1 User=lookup +BootModes=text,graphical [DHCPClient] Priority=low KeepAlive=1 User=root +BootModes=text,graphical [NotificationServer] Socket=/tmp/portal/notify @@ -37,6 +35,7 @@ Socket=/tmp/portal/launch SocketPermissions=600 Lazy=1 User=anon +BootModes=text,graphical [WindowServer] Socket=/tmp/portal/window @@ -109,3 +108,17 @@ User=anon [Terminal] User=anon WorkingDirectory=/home/anon + +[Shell@tty0] +Executable=/bin/Shell +StdIO=/dev/tty0 +Environment=TERM=xterm +KeepAlive=1 +BootModes=text + +[Shell@tty1] +Executable=/bin/Shell +StdIO=/dev/tty1 +Environment=TERM=xterm +KeepAlive=1 +BootModes=text diff --git a/Base/usr/share/man/man5/SystemServer.md b/Base/usr/share/man/man5/SystemServer.md index 3e5ceb957d..a5cede161f 100644 --- a/Base/usr/share/man/man5/SystemServer.md +++ b/Base/usr/share/man/man5/SystemServer.md @@ -50,12 +50,13 @@ Priority=low KeepAlive=1 User=anon -# Spawn the TTYServer on /dev/tty1 once on startup with a high priority, -# additionally passing it "tty1" as an argument. -[TTYServer] -Arguments=tty1 -StdIO=/dev/tty1 -Priority=high +# Launch the Shell on /dev/tty0 on startup when booting in text mode. +[Shell@tty0] +Executable=/bin/Shell +StdIO=/dev/tty0 +Environment=TERM=xterm +KeepAlive=1 +BootModes=text ``` ## See also diff --git a/Services/CMakeLists.txt b/Services/CMakeLists.txt index 4a2b261d06..61f03a3e92 100644 --- a/Services/CMakeLists.txt +++ b/Services/CMakeLists.txt @@ -9,6 +9,5 @@ add_subdirectory(SystemMenu) add_subdirectory(SystemServer) add_subdirectory(Taskbar) add_subdirectory(TelnetServer) -add_subdirectory(TTYServer) add_subdirectory(WebServer) add_subdirectory(WindowServer) diff --git a/Services/TTYServer/CMakeLists.txt b/Services/TTYServer/CMakeLists.txt deleted file mode 100644 index 69753bbea8..0000000000 --- a/Services/TTYServer/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(SOURCES - main.cpp -) - -serenity_bin(TTYServer) -target_link_libraries(TTYServer LibC) diff --git a/Services/TTYServer/main.cpp b/Services/TTYServer/main.cpp deleted file mode 100644 index 79e43ca84b..0000000000 --- a/Services/TTYServer/main.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - if (pledge("stdio tty proc exec", nullptr) < 0) { - perror("pledge"); - return 1; - } - - if (unveil("/bin/Shell", "x") < 0) { - perror("unveil"); - return 1; - } - - unveil(nullptr, nullptr); - - if (argc < 2) - return -1; - - dbgprintf("Starting console server on %s\n", argv[1]); - - while (true) { - dbgprintf("Running shell on %s\n", argv[1]); - - auto child = fork(); - if (!child) { - int rc = execl("/bin/Shell", "Shell", nullptr); - ASSERT(rc < 0); - perror("execl"); - exit(127); - } else { - int wstatus; - waitpid(child, &wstatus, 0); - dbgprintf("Shell on %s exited with code %d\n", argv[1], WEXITSTATUS(wstatus)); - } - } -}