Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/bin/makebin
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ package() {
install -D -m644 "target/_surface" "$pkgdir/shell-completions/surface.zsh"
install -D -m644 "target/surface.fish" "$pkgdir/shell-completions/surface.fish"

# copy service files
install -D -m644 "systemd/surface-rapl.service" "$pkgdir/usr/lib/systemd/system/surface-rapl.service"
install -D -m744 "systemd/surface-rapl.sh" "$pkgdir/usr/libexec/surface-rapl.sh"
mkdir -p "$pkgdir/usr/lib/systemd/system/multi-user.target.wants"
ln -sT "../surface-rapl.service" "$pkgdir/usr/lib/systemd/system/multi-user.target.wants/surface-rapl.service"
mkdir -p "$pkgdir/usr/lib/systemd/system/suspend.target.wants"
ln -sT "../surface-rapl.service" "$pkgdir/usr/lib/systemd/system/suspend.target.wants/surface-rapl.service"

# copy license
install -D -m644 "LICENSE" "$pkgdir/LICENSE"

Expand Down
1 change: 1 addition & 0 deletions pkg/deb/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ src/
*.buildinfo
*.changes
*.deb
*.ddeb
8 changes: 8 additions & 0 deletions pkg/deb/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ override_dh_install:
install -D -m644 "target/_surface" "${pkgdir}/usr/share/zsh/vendor-completions/_surface"
install -D -m644 "target/surface.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/surface.fish"

# service files
install -D -m644 "systemd/surface-rapl.service" "${pkgdir}/usr/lib/systemd/system/surface-rapl.service"
install -D -m744 "systemd/surface-rapl.sh" "${pkgdir}/usr/libexec/surface-rapl.sh"
mkdir -p "${pkgdir}/usr/lib/systemd/system/multi-user.target.wants"
ln -sT "../surface-rapl.service" "${pkgdir}/usr/lib/systemd/system/multi-user.target.wants/surface-rapl.service"
mkdir -p "${pkgdir}/usr/lib/systemd/system/suspend.target.wants"
ln -sT "../surface-rapl.service" "${pkgdir}/usr/lib/systemd/system/suspend.target.wants/surface-rapl.service"

%:
dh $@
6 changes: 6 additions & 0 deletions pkg/fedora/surface-control.spec
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ install -D -m755 "target/release/surface" "%{buildroot}/usr/bin/surface"
install -D -m644 "target/surface.bash" "%{buildroot}/usr/share/bash-completion/completions/surface"
install -D -m644 "target/_surface" "%{buildroot}/usr/share/zsh/site-functions/_surface"
install -D -m644 "target/surface.fish" "%{buildroot}/usr/share/fish/vendor_completions.d/surface.fish"
install -D -m644 "systemd/surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/surface-rapl.service"
install -D -m744 "systemd/surface-rapl.sh" "%{buildroot}/usr/libexec/surface-rapl.sh"
mkdir -p "%{buildroot}/usr/lib/systemd/system/multi-user.target.wants"
ln -sT "../surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/multi-user.target.wants/surface-rapl.service"
mkdir -p "%{buildroot}/usr/lib/systemd/system/suspend.target.wants"
ln -sT "../surface-rapl.service" "%{buildroot}/usr/lib/systemd/system/suspend.target.wants/surface-rapl.service"

%files
/usr/bin/surface
Expand Down
11 changes: 11 additions & 0 deletions systemd/surface-rapl.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=Undoes firmware throttling processor after low-battery boot/resume
After=suspend.target

[Service]
Type=oneshot
ExecStart=/usr/libexec/surface-rapl.sh

[Install]
WantedBy=multi-user.target
WantedBy=suspend.target
3 changes: 3 additions & 0 deletions systemd/surface-rapl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
target=/sys/devices/virtual/powercap/intel-rapl/intel-rapl:0/constraint_2_power_limit_uw
[ -f "$target" ] && echo 0 > "$target" || :