-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #437 from amazonlinux/acpid
Package acpid to handle shutdown signals
- Loading branch information
Showing
10 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"acpid", | ||
"aws-iam-authenticator", | ||
"bash", | ||
"ca-certificates", | ||
|
27 changes: 27 additions & 0 deletions
27
packages/acpid/0001-Remove-shell-dependency-by-only-shutting-down.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From 1a6c5126697cb171eae3922d822ae90b18176e1f Mon Sep 17 00:00:00 2001 | ||
From: iliana destroyer of worlds <[email protected]> | ||
Date: Fri, 18 Oct 2019 22:56:45 +0000 | ||
Subject: [PATCH] Remove shell dependency by only shutting down | ||
|
||
Thar doesn't have a shell, so this is a hack to get what we want | ||
(shutdown behavior on power button press) without rearchitecting acpid. | ||
--- | ||
event.c | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/event.c b/event.c | ||
index 6c67062..defdc42 100644 | ||
--- a/event.c | ||
+++ b/event.c | ||
@@ -687,7 +687,7 @@ do_cmd_rule(struct rule *rule, const char *event) | ||
fprintf(stdout, "BEGIN HANDLER MESSAGES\n"); | ||
} | ||
umask(0077); | ||
- execl("/bin/sh", "/bin/sh", "-c", action, NULL); | ||
+ execl("/sbin/shutdown", "/sbin/shutdown", "-h", "now", "Power button pressed", NULL); | ||
/* should not get here */ | ||
acpid_log(LOG_ERR, "execl(): %s", strerror(errno)); | ||
_exit(EXIT_FAILURE); | ||
-- | ||
2.20.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "acpid" | ||
version = "0.1.0" | ||
edition = "2018" | ||
publish = false | ||
build = "build.rs" | ||
|
||
[lib] | ||
path = "pkg.rs" | ||
|
||
[[package.metadata.build-package.external-files]] | ||
url = "http://downloads.sourceforge.net/acpid2/acpid-2.0.32.tar.xz" | ||
sha512 = "c7afffdf9818504e1ac03b0ad693a05f772bfd07af9808262b3b6bb82ca4dabe6253c94e6dc59e5be6f0da9e815e8bcf2d3e16f02b23d0248b6bad4509e78be7" | ||
|
||
[build-dependencies] | ||
buildsys = { path = "../../tools/buildsys" } | ||
glibc = { path = "../glibc", optional=true } | ||
|
||
[features] | ||
cascade = [ | ||
"glibc", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[Unit] | ||
Description=ACPI event daemon | ||
|
||
[Service] | ||
Type=forking | ||
ExecStart=/usr/sbin/acpid -c /usr/lib/acpid/events | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Name: %{_cross_os}acpid | ||
Version: 2.0.32 | ||
Release: 1%{?dist} | ||
Summary: ACPI event daemon | ||
License: GPLv2+ | ||
URL: http://sourceforge.net/projects/acpid2/ | ||
Source0: http://downloads.sourceforge.net/acpid2/acpid-%{version}.tar.xz | ||
Source1: acpid.service | ||
Source2: power.conf | ||
Patch1: 0001-Remove-shell-dependency-by-only-shutting-down.patch | ||
BuildRequires: gcc-%{_cross_target} | ||
BuildRequires: %{_cross_os}glibc-devel | ||
Requires: %{_cross_os}glibc | ||
|
||
%description | ||
%{summary}. | ||
|
||
%prep | ||
%autosetup -n acpid-%{version} -p1 | ||
|
||
%build | ||
%cross_configure | ||
%make_build | ||
|
||
%install | ||
%make_install | ||
|
||
install -d %{buildroot}%{_cross_unitdir} | ||
install -p -m 0644 %{S:1} %{buildroot}%{_cross_unitdir} | ||
|
||
install -d %{buildroot}%{_cross_libdir}/acpid/events | ||
install -p -m 0644 %{S:2} %{buildroot}%{_cross_libdir}/acpid/events/power | ||
|
||
%files | ||
%{_cross_sbindir}/acpid | ||
%{_cross_unitdir}/acpid.service | ||
%{_cross_libdir}/acpid/ | ||
%exclude %{_cross_bindir}/acpi_listen | ||
%exclude %{_cross_sbindir}/kacpimon | ||
%exclude %{_cross_docdir} | ||
%exclude %{_cross_mandir} | ||
|
||
%changelog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
if let Err(e) = buildsys::build_package() { | ||
eprintln!("{}", e); | ||
std::process::exit(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// not used |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
event=button/power | ||
action=/sbin/shutdown -h now "Power button pressed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters