Compare commits

...

8 Commits

Author SHA1 Message Date
mainnika f344d62a04 fix binary path in systemd 2024-05-18 11:14:56 +02:00
mainnika c0eb787ac9 bump readme 2024-05-18 08:47:38 +02:00
mainnika ed7adc4fd1 archive rpms with latest upload artifact 2024-05-18 08:26:38 +02:00
mainnika 6497f3c442 use privileged 2024-05-18 08:20:08 +02:00
mainnika 75f4ab1d28 use simple isolation 2024-05-18 08:17:52 +02:00
mainnika e53eccce0b github workflow to build rpm 2024-05-18 08:14:08 +02:00
mainnika 76ba300436 add systemd unit args 2024-05-18 07:08:52 +02:00
mainnika 117fcf3dab remove invalid noargs 2024-05-18 07:03:10 +02:00
6 changed files with 92 additions and 3 deletions
+44
View File
@@ -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
+40
View File
@@ -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
```
+1 -2
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
ACPI_WAKEUP_FIXXER_ARGS=""
+2 -1
View File
@@ -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/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