mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Support multiple TTYs with systemd service (closes #102)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -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;
|
var service_dir = std.fs.cwd().openDir(service_path, .{}) catch unreachable;
|
||||||
defer service_dir.close();
|
defer service_dir.close();
|
||||||
|
|
||||||
const patched_service = try patchFile(allocator, "res/ly.service", patch_map);
|
const patched_service = try patchFile(allocator, "res/ly@.service", patch_map);
|
||||||
try installText(patched_service, service_dir, service_path, "ly.service", .{ .mode = 0o644 });
|
try installText(patched_service, service_dir, service_path, "ly@.service", .{ .mode = 0o644 });
|
||||||
},
|
},
|
||||||
.openrc => {
|
.openrc => {
|
||||||
const service_path = try std.fs.path.join(allocator, &[_][]const u8{ dest_directory, config_directory, "/init.d" });
|
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");
|
try deleteFile(allocator, config_directory, "/pam.d/ly", "ly pam file not found");
|
||||||
|
|
||||||
switch (init_system) {
|
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"),
|
.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"),
|
.runit => try deleteTree(allocator, config_directory, "/sv/ly", "runit service not found"),
|
||||||
.s6 => {
|
.s6 => {
|
||||||
|
|||||||
@@ -111,19 +111,19 @@ command:
|
|||||||
Then, similarly to the previous command, you need to enable the Ly service:
|
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
|
**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
|
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:
|
||||||
execute the following command:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
# systemctl disable getty@tty2.service
|
# systemctl disable getty@tty2.service
|
||||||
```
|
```
|
||||||
|
|
||||||
You can change the TTY Ly will run on by editing the corresponding
|
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
|
### OpenRC
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=TUI display manager
|
Description=TUI display manager
|
||||||
After=systemd-user-sessions.service plymouth-quit-wait.service
|
After=systemd-user-sessions.service plymouth-quit-wait.service
|
||||||
After=getty@tty$DEFAULT_TTY.service
|
After=getty@%I.service
|
||||||
Conflicts=getty@tty$DEFAULT_TTY.service
|
Conflicts=getty@%I.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=idle
|
Type=idle
|
||||||
ExecStart=$PREFIX_DIRECTORY/bin/$EXECUTABLE_NAME
|
ExecStart=$PREFIX_DIRECTORY/bin/$EXECUTABLE_NAME
|
||||||
StandardInput=tty
|
StandardInput=tty
|
||||||
TTYPath=/dev/tty$DEFAULT_TTY
|
TTYPath=/dev/%I
|
||||||
TTYReset=yes
|
TTYReset=yes
|
||||||
TTYVHangup=yes
|
TTYVHangup=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
Alias=display-manager.service
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user