Skip to content

Commit 33d5bee

Browse files
committed
fixup! systemd: Disable Intel RAPL PL4 on resume/boot
1 parent e8bde77 commit 33d5bee

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

build.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::env;
2+
use std::path::PathBuf;
23
use clap_complete::shells;
34

45
#[allow(dead_code)]
@@ -10,15 +11,33 @@ mod cli;
1011
mod sys;
1112

1213

14+
1315
fn main() {
14-
let outdir = env::var_os("CARGO_TARGET_DIR")
16+
let outdir: PathBuf = env::var_os("CARGO_TARGET_DIR")
1517
.or_else(|| env::var_os("OUT_DIR"))
16-
.unwrap();
18+
.unwrap()
19+
.into();
20+
21+
let rootdir = env::current_dir().unwrap();
1722

1823
let reg = cli::build();
1924
let mut app = reg.cli();
2025

2126
clap_complete::generate_to(shells::Bash, &mut app, "surface", &outdir).unwrap();
2227
clap_complete::generate_to(shells::Zsh, &mut app, "surface", &outdir).unwrap();
2328
clap_complete::generate_to(shells::Fish, &mut app, "surface", &outdir).unwrap();
29+
30+
// copy config files
31+
let files = [
32+
"systemd/surface-rapl.service",
33+
"systemd/surface-rapl.sh",
34+
];
35+
36+
for file in files {
37+
let src = rootdir.join(file);
38+
let tgt = outdir.join(file);
39+
40+
std::fs::create_dir_all(tgt.parent().unwrap()).unwrap();
41+
std::fs::copy(src, tgt).unwrap();
42+
}
2443
}

pkg/fedora/surface-control.spec

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,16 @@ install -D -m755 "target/release/surface" "%{buildroot}/usr/bin/surface"
3131
install -D -m644 "target/surface.bash" "%{buildroot}/usr/share/bash-completion/completions/surface"
3232
install -D -m644 "target/_surface" "%{buildroot}/usr/share/zsh/site-functions/_surface"
3333
install -D -m644 "target/surface.fish" "%{buildroot}/usr/share/fish/vendor_completions.d/surface.fish"
34-
install -D -m644 "systemd/surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/surface-rapl.service"
35-
install -D -m744 "systemd/surface-rapl.sh" "%{buildroot}/usr/libexec/surface-rapl.sh"
36-
mkdir -p "%{buildroot}/usr/lib/systemd/system/multi-user.target.wants"
37-
ln -sT "../surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/multi-user.target.wants/surface-rapl.service"
38-
mkdir -p "%{buildroot}/usr/lib/systemd/system/suspend.target.wants"
39-
ln -sT "../surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/suspend.target.wants/surface-rapl.service"
34+
install -D -m644 "target/systemd/surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/surface-rapl.service"
35+
install -D -m744 "target/systemd/surface-rapl.sh" "%{buildroot}/usr/libexec/surface-rapl.sh"
4036

4137
%files
4238
/usr/bin/surface
4339
/usr/share/bash-completion/completions/surface
4440
/usr/share/zsh/site-functions/_surface
4541
/usr/share/fish/vendor_completions.d/surface.fish
42+
/usr/lib/systemd/system/surface-rapl.service
43+
/usr/libexec/surface-rapl.sh
4644

4745
%changelog
4846
* Sun Jan 25 2026 Maximilian Luz <luzmaximilian@gmail.com> - 0.5.0-1

0 commit comments

Comments
 (0)