Compare commits

...

7 Commits

  1. 44
      .github/workflows/build-rpm.yaml
  2. 40
      README.md
  3. 3
      cmd/acpi-wakeup-fixxer/main.go
  4. 4
      rpm/golang-code-tokarch-mainnika-acpi-wakeup-fixxer.spec
  5. 1
      systemd/acpi-wakeup-fixxer
  6. 3
      systemd/acpi-wakeup-fixxer.service

@ -0,0 +1,44 @@
name: Build RPM
on:
workflow_dispatch:
inputs:
ref:
description: 'branch or tag ref'
required: true
default: 'refs/heads/main'
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
container:
image: fedora:40
options: --privileged
steps:
- name: Install dependencies
run: |
dnf install -y mock rpm-build
- name: Download sources tar.gz archive
run: |
curl -LO https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz
FILENAME=$(ls)
ARCHIVENAME=$(basename $FILENAME .tar.gz)
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
echo "ARCHIVENAME=$ARCHIVENAME" >> $GITHUB_ENV
- name: Build RPM
run: |
tar --strip-components=1 -xvf $FILENAME '*/rpm/golang-code-tokarch-mainnika-acpi-wakeup-fixxer.spec'
mock --init
mock --buildsrpm --spec rpm/golang-code-tokarch-mainnika-acpi-wakeup-fixxer.spec --sources $FILENAME --rpmbuild-opts="-D'__archivename $ARCHIVENAME' -D'__archiveext tar.gz'" --rebuild --isolation=simple
- name: Archive RPMs
uses: actions/upload-artifact@v4
with:
name: RPMs
path: /var/lib/mock/*/result/*.rpm

@ -1 +1,41 @@
# acpi-wakeup-fixxer # acpi-wakeup-fixxer
This repository contains a tool to disable the wakeup ability on your macbook system that runs linux, which can be particularly useful to prevent immediate wakeup from suspend mode. This tool is compatible with various systems, including the MacBook Air 2013/2015.
# features
- disables wakeup by echoing a device name to /proc/acpi/wakeup
- default list of devices to disable is LID0 XHC1
- one can adjust the list by using `-disable` flag
- systemd unit runs the app on load and resume
# installation
## rhel/fedora systems
- take latest artifacts from https://github.com/mainnika/acpi-wakeup-fixxer/actions/workflows/build-rpm.yaml
- unzip and install `fedora-40-x86_64/result/golang-code-tokarch-mainnika-acpi-wakeup-fixxer-0-0.1.fc40.x86_64.rpm`
## build from sources
- `go build -o acpi-wakeup-fixxer ./cmd/acpi-wakeup-fixxer`
# systemd
```
[Unit]
Description=Fix ACPI wakeup issues
DefaultDependencies=no
Conflicts=shutdown.target
Before=sysinit.target shutdown.target
ConditionPathExists=|/proc/acpi/wakeup
[Service]
ExecStart=/usr/local/bin/acpi-wakeup-fixxer $ACPI_WAKEUP_FIXXER_ARGS
Type=oneshot
TimeoutSec=0
RemainAfterExit=yes
EnvironmentFile=-/etc/default/acpi-wakeup-fixxer
[Install]
WantedBy=sysinit.target
```

@ -15,9 +15,8 @@ var (
) )
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
Use: "acpi-wakeup-fixxer",
Short: "A CLI tool to fix ACPI wakeup issues", Short: "A CLI tool to fix ACPI wakeup issues",
Args: cobra.NoArgs, Use: "acpi-wakeup-fixxer",
Long: "acpi-wakeup-fixxer is a command-line tool to fix ACPI wakeup issues on your system.", Long: "acpi-wakeup-fixxer is a command-line tool to fix ACPI wakeup issues on your system.",
Run: rootCmdRun, Run: rootCmdRun,
} }

@ -46,6 +46,9 @@ install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
install -m 0755 -vd %{buildroot}%{_unitdir} install -m 0755 -vd %{buildroot}%{_unitdir}
install -m 0644 -vp systemd/acpi-wakeup-fixxer.service %{buildroot}%{_unitdir}/ install -m 0644 -vp systemd/acpi-wakeup-fixxer.service %{buildroot}%{_unitdir}/
install -m 0755 -vd %{buildroot}%{_sysconfdir}/default
install -m 0644 -vp systemd/acpi-wakeup-fixxer %{buildroot}%{_sysconfdir}/default/
%if %{with check} %if %{with check}
%check %check
%gocheck %gocheck
@ -56,6 +59,7 @@ install -m 0644 -vp systemd/acpi-wakeup-fixxer.service %{buildroot}%{_unitdir}/
%doc README.md %doc README.md
%{_bindir}/* %{_bindir}/*
%{_unitdir}/acpi-wakeup-fixxer.service %{_unitdir}/acpi-wakeup-fixxer.service
%config(noreplace) %{_sysconfdir}/default/acpi-wakeup-fixxer
%gopkgfiles %gopkgfiles

@ -0,0 +1 @@
ACPI_WAKEUP_FIXXER_ARGS=""

@ -6,10 +6,11 @@ Before=sysinit.target shutdown.target
ConditionPathExists=|/proc/acpi/wakeup ConditionPathExists=|/proc/acpi/wakeup
[Service] [Service]
ExecStart=/usr/local/bin/acpi-wakeup-fixxer ExecStart=/usr/local/bin/acpi-wakeup-fixxer $ACPI_WAKEUP_FIXXER_ARGS
Type=oneshot Type=oneshot
TimeoutSec=0 TimeoutSec=0
RemainAfterExit=yes RemainAfterExit=yes
EnvironmentFile=-/etc/default/acpi-wakeup-fixxer
[Install] [Install]
WantedBy=sysinit.target WantedBy=sysinit.target

Loading…
Cancel
Save