mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Merge branch 'main' into 'main'
add a protection to not allow running asusd in terminal Closes #104 See merge request asus-linux/asusctl!64
This commit is contained in:
@@ -20,6 +20,7 @@ use std::error::Error;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
use daemon::ctrl_rog_bios::CtrlRogBios;
|
use daemon::ctrl_rog_bios::CtrlRogBios;
|
||||||
use std::convert::Into;
|
use std::convert::Into;
|
||||||
@@ -35,6 +36,18 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
.filter(None, LevelFilter::Info)
|
.filter(None, LevelFilter::Info)
|
||||||
.init();
|
.init();
|
||||||
|
|
||||||
|
let is_service = match env::var_os("IS_SERVICE") {
|
||||||
|
Some(val) => val == "1",
|
||||||
|
None => false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if !is_service {
|
||||||
|
println!("asusd schould be only run from the right systemd service");
|
||||||
|
println!("do not run in your terminal, if you need an logs please use journalctl -b -u asusd");
|
||||||
|
println!("asusd will now exit");
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
info!(" daemon v{}", daemon::VERSION);
|
info!(" daemon v{}", daemon::VERSION);
|
||||||
info!(" rog-anime v{}", rog_anime::VERSION);
|
info!(" rog-anime v{}", rog_anime::VERSION);
|
||||||
info!(" rog-aura v{}", rog_aura::VERSION);
|
info!(" rog-aura v{}", rog_aura::VERSION);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ Description=ASUS Notebook Control
|
|||||||
After=basic.target syslog.target
|
After=basic.target syslog.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Environment=IS_SERVICE=1
|
||||||
ExecStart=/usr/bin/asusd
|
ExecStart=/usr/bin/asusd
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Type=dbus
|
Type=dbus
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ StartLimitBurst=2
|
|||||||
Before=display-manager.service
|
Before=display-manager.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Environment=IS_SERVICE=1
|
||||||
ExecStart=/usr/bin/asusd
|
ExecStart=/usr/bin/asusd
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
Restart=always
|
Restart=always
|
||||||
|
|||||||
Reference in New Issue
Block a user