Support multiple TTYs with systemd service (closes #102)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-12-02 22:11:39 +01:00
parent 3365b33d6d
commit b249dba092
3 changed files with 11 additions and 11 deletions

View File

@@ -260,8 +260,8 @@ fn install_service(allocator: std.mem.Allocator, patch_map: PatchMap) !void {
var service_dir = std.fs.cwd().openDir(service_path, .{}) catch unreachable;
defer service_dir.close();
const patched_service = try patchFile(allocator, "res/ly.service", patch_map);
try installText(patched_service, service_dir, service_path, "ly.service", .{ .mode = 0o644 });
const patched_service = try patchFile(allocator, "res/ly@.service", patch_map);
try installText(patched_service, service_dir, service_path, "ly@.service", .{ .mode = 0o644 });
},
.openrc => {
const service_path = try std.fs.path.join(allocator, &[_][]const u8{ dest_directory, config_directory, "/init.d" });
@@ -365,7 +365,7 @@ pub fn Uninstaller(uninstall_config: bool) type {
try deleteFile(allocator, config_directory, "/pam.d/ly", "ly pam file not found");
switch (init_system) {
.systemd => try deleteFile(allocator, prefix_directory, "/lib/systemd/system/ly.service", "systemd service not found"),
.systemd => try deleteFile(allocator, prefix_directory, "/lib/systemd/system/ly@.service", "systemd service not found"),
.openrc => try deleteFile(allocator, config_directory, "/init.d/ly", "openrc service not found"),
.runit => try deleteTree(allocator, config_directory, "/sv/ly", "runit service not found"),
.s6 => {

View File

@@ -111,19 +111,19 @@ command:
Then, similarly to the previous command, you need to enable the Ly service:
```
# systemctl enable ly.service
# systemctl enable ly@tty2.service
```
**Important**: Because Ly runs in a TTY, you **must** disable the TTY service
that Ly will run on, otherwise bad things will happen. For example, to disable `getty` spawning on TTY 2 (the default TTY on which Ly spawns), you need to
execute the following command:
that Ly will run on, otherwise bad things will happen. For example, to disable `getty` spawning on TTY 2, you need to execute the following command:
```
# systemctl disable getty@tty2.service
```
You can change the TTY Ly will run on by editing the corresponding
service file for your platform.
service file for your platform, or on systemd, by enabling the service on
different TTYs, as is done above.
### OpenRC

View File

@@ -1,16 +1,16 @@
[Unit]
Description=TUI display manager
After=systemd-user-sessions.service plymouth-quit-wait.service
After=getty@tty$DEFAULT_TTY.service
Conflicts=getty@tty$DEFAULT_TTY.service
After=getty@%I.service
Conflicts=getty@%I.service
[Service]
Type=idle
ExecStart=$PREFIX_DIRECTORY/bin/$EXECUTABLE_NAME
StandardInput=tty
TTYPath=/dev/tty$DEFAULT_TTY
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
[Install]
Alias=display-manager.service
WantedBy=multi-user.target