mirror of
https://github.com/coastalwhite/lemurs
synced 2024-11-29 21:10:18 +00:00
Impr: Properly integrate no-log with xorg/client log
This commit is contained in:
parent
3084b778ab
commit
a310466e68
5 changed files with 30 additions and 12 deletions
|
@ -55,6 +55,9 @@ client_log_path = "/var/log/lemurs.client.log"
|
||||||
# Where to log to for the XServer.
|
# Where to log to for the XServer.
|
||||||
xserver_log_path = "/var/log/lemurs.xorg.log"
|
xserver_log_path = "/var/log/lemurs.xorg.log"
|
||||||
|
|
||||||
|
# Disable all logging. This is overwritten by the `--no-log` flag.
|
||||||
|
no_log = false
|
||||||
|
|
||||||
# The PAM service that should be used to login
|
# The PAM service that should be used to login
|
||||||
pam_service = "lemurs"
|
pam_service = "lemurs"
|
||||||
|
|
||||||
|
|
|
@ -159,6 +159,8 @@ toml_config_struct! { Config, PartialConfig,
|
||||||
client_log_path => String,
|
client_log_path => String,
|
||||||
xserver_log_path => String,
|
xserver_log_path => String,
|
||||||
|
|
||||||
|
no_log => bool,
|
||||||
|
|
||||||
pam_service => String,
|
pam_service => String,
|
||||||
|
|
||||||
shell_login_flag => ShellLoginFlag,
|
shell_login_flag => ShellLoginFlag,
|
||||||
|
|
|
@ -141,6 +141,8 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
if !cli.no_log {
|
if !cli.no_log {
|
||||||
setup_logger(cli.preview);
|
setup_logger(cli.preview);
|
||||||
info!("Lemurs logger is running");
|
info!("Lemurs logger is running");
|
||||||
|
} else {
|
||||||
|
config.no_log = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cli.preview {
|
if !cli.preview {
|
||||||
|
|
|
@ -172,13 +172,18 @@ impl PostLoginEnvironment {
|
||||||
ShellLoginFlag::Long => Some("--login"),
|
ShellLoginFlag::Long => Some("--login"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let client = lower_command_permissions_to_user(Command::new(SYSTEM_SHELL), user_info);
|
let mut client = lower_command_permissions_to_user(Command::new(SYSTEM_SHELL), user_info);
|
||||||
|
|
||||||
|
let mut client = if config.no_log {
|
||||||
|
client.stdout(Stdio::null()).stderr(Stdio::null());
|
||||||
|
client
|
||||||
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"Setup client to log `stdout` and `stderr` to '{log_path}'",
|
"Setup client to log `stdout` and `stderr` to '{log_path}'",
|
||||||
log_path = config.client_log_path
|
log_path = config.client_log_path
|
||||||
);
|
);
|
||||||
let mut client = output_command_to_log(client, Path::new(&config.client_log_path));
|
output_command_to_log(client, Path::new(&config.client_log_path))
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(shell_login_flag) = shell_login_flag {
|
if let Some(shell_login_flag) = shell_login_flag {
|
||||||
client.arg(shell_login_flag);
|
client.arg(shell_login_flag);
|
||||||
|
|
|
@ -135,12 +135,18 @@ pub fn setup_x(
|
||||||
libc::signal(SIGUSR1, SIG_IGN);
|
libc::signal(SIGUSR1, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
let child = Command::new(super::SYSTEM_SHELL);
|
let mut child = Command::new(super::SYSTEM_SHELL);
|
||||||
|
|
||||||
|
let mut child = if config.no_log {
|
||||||
|
child.stdout(Stdio::null()).stderr(Stdio::null());
|
||||||
|
child
|
||||||
|
} else {
|
||||||
info!(
|
info!(
|
||||||
"Setup XServer to log `stdout` and `stderr` to '{log_path}'",
|
"Setup XServer to log `stdout` and `stderr` to '{log_path}'",
|
||||||
log_path = config.xserver_log_path
|
log_path = config.xserver_log_path
|
||||||
);
|
);
|
||||||
let mut child = output_command_to_log(child, Path::new(&config.xserver_log_path));
|
output_command_to_log(child, Path::new(&config.xserver_log_path))
|
||||||
|
};
|
||||||
let mut child = child
|
let mut child = child
|
||||||
.arg("-c")
|
.arg("-c")
|
||||||
.arg(format!("/usr/bin/X {display_value} vt{doubledigit_vtnr}"))
|
.arg(format!("/usr/bin/X {display_value} vt{doubledigit_vtnr}"))
|
||||||
|
|
Loading…
Reference in a new issue