From be49936400af663503ef45d03faddebc51bd54d7 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Thu, 21 Jul 2016 23:08:14 -0700 Subject: [PATCH] Support lid close in acpid --- images/02-acpid/Dockerfile | 3 +++ images/02-acpid/lid | 2 ++ images/02-acpid/suspend.sh | 4 ++++ os-config.tpl.yml | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 images/02-acpid/Dockerfile create mode 100644 images/02-acpid/lid create mode 100755 images/02-acpid/suspend.sh diff --git a/images/02-acpid/Dockerfile b/images/02-acpid/Dockerfile new file mode 100644 index 00000000..e83a345c --- /dev/null +++ b/images/02-acpid/Dockerfile @@ -0,0 +1,3 @@ +FROM rancher/os-base +COPY lid /etc/acpi/events/ +COPY suspend.sh /etc/acpi/suspend.sh diff --git a/images/02-acpid/lid b/images/02-acpid/lid new file mode 100644 index 00000000..3a85989c --- /dev/null +++ b/images/02-acpid/lid @@ -0,0 +1,2 @@ +event=button/lid +action=/etc/acpi/suspend.sh %e diff --git a/images/02-acpid/suspend.sh b/images/02-acpid/suspend.sh new file mode 100755 index 00000000..304bca31 --- /dev/null +++ b/images/02-acpid/suspend.sh @@ -0,0 +1,4 @@ +#!/bin/sh +if [ "$3" = "close" ]; then + echo -n "mem" > /sys/power/state +fi diff --git a/os-config.tpl.yml b/os-config.tpl.yml index 1c589277..89d8640d 100644 --- a/os-config.tpl.yml +++ b/os-config.tpl.yml @@ -83,7 +83,7 @@ rancher: services: {{if eq "amd64" .ARCH -}} acpid: - image: {{.OS_REPO}}/os-base:{{.VERSION}}{{.SUFFIX}} + image: {{.OS_REPO}}/os-acpid:{{.VERSION}}{{.SUFFIX}} command: /usr/sbin/acpid -f labels: io.rancher.os.scope: system