|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 42483a747489ff46aed3588b78bf4b9480dbeaf7 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: Ivan Shapovalov <intelfx100@gmail.com>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Wed, 27 Aug 2014 00:17:44 +0400
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] hibernate-resume: add a tool to write a device node's
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
major:minor to /sys/power/resume.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
This can be used to initiate a resume from hibernation by path to a swap
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
device containing the hibernation image.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
The respective templated unit is also added. It is instantiated using
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
path to the desired resume device.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
.gitignore | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Makefile-man.am | 7 +++
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Makefile.am | 17 +++++--
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hibernate-resume@.service.xml | 81 ++++++++++++++++++++++++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/hibernate-resume/Makefile | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/hibernate-resume/hibernate-resume.c | 81 ++++++++++++++++++++++++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/.gitignore | 1 +
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/systemd-hibernate-resume@.service.in | 20 ++++++++
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
8 files changed, 206 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
create mode 100644 man/systemd-hibernate-resume@.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
create mode 120000 src/hibernate-resume/Makefile
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
create mode 100644 src/hibernate-resume/hibernate-resume.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
create mode 100644 units/systemd-hibernate-resume@.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/.gitignore b/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 8189da71f0..0b5608ccf9 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -75,6 +75,7 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-getty-generator
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-gnome-ask-password-agent
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-gpt-auto-generator
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+/systemd-hibernate-resume
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-hostnamed
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-inhibit
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-initctl
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/Makefile-man.am b/Makefile-man.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 562ecba435..09a10383a9 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/Makefile-man.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/Makefile-man.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -70,6 +70,7 @@ MANPAGES += \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-getty-generator.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-gpt-auto-generator.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-halt.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ man/systemd-hibernate-resume@.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-inhibit.1 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-initctl.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-journald.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -199,6 +200,7 @@ MANPAGES_ALIAS += \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-firstboot.service.1 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-fsck-root.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-fsck.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ man/systemd-hibernate-resume.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hibernate.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hybrid-sleep.service.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-initctl.8 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -305,6 +307,7 @@ man/systemd-ask-password-wall.service.8: man/systemd-ask-password-console.servic
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-firstboot.service.1: man/systemd-firstboot.1
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-fsck-root.service.8: man/systemd-fsck@.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-fsck.8: man/systemd-fsck@.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+man/systemd-hibernate-resume.8: man/systemd-hibernate-resume@.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hibernate.service.8: man/systemd-suspend.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hybrid-sleep.service.8: man/systemd-suspend.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-initctl.8: man/systemd-initctl.service.8
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -567,6 +570,9 @@ man/systemd-fsck-root.service.html: man/systemd-fsck@.service.html
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-fsck.html: man/systemd-fsck@.service.html
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
$(html-alias)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+man/systemd-hibernate-resume.html: man/systemd-hibernate-resume@.service.html
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ $(html-alias)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hibernate.service.html: man/systemd-suspend.service.html
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
$(html-alias)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1619,6 +1625,7 @@ EXTRA_DIST += \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-getty-generator.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-gpt-auto-generator.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-halt.service.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ man/systemd-hibernate-resume@.service.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-hostnamed.service.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-inhibit.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd-initctl.service.xml \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/Makefile.am b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index cbf98bdac3..a487caa7bc 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/Makefile.am
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -378,7 +378,8 @@ rootlibexec_PROGRAMS = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemd-sleep \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemd-bus-proxyd \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemd-socket-proxyd \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- systemd-update-done
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd-update-done \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd-hibernate-resume
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemgenerator_PROGRAMS = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemd-getty-generator \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -528,7 +529,8 @@ nodist_systemunit_DATA = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/initrd-udevadm-cleanup-db.service \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/initrd-switch-root.service \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/systemd-nspawn@.service \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- units/systemd-update-done.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ units/systemd-update-done.service \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ units/systemd-hibernate-resume@.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
dist_userunit_DATA = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/user/basic.target \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -575,7 +577,8 @@ EXTRA_DIST += \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/initrd-udevadm-cleanup-db.service.in \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/initrd-switch-root.service.in \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/systemd-nspawn@.service.in \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- units/systemd-update-done.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ units/systemd-update-done.service.in \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ units/systemd-hibernate-resume@.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
CLEANFILES += \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
units/console-shell.service.m4 \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -2103,6 +2106,14 @@ systemd_delta_LDADD = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
libsystemd-shared.la
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
# ------------------------------------------------------------------------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+systemd_hibernate_resume_SOURCES = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ src/hibernate-resume/hibernate-resume.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+systemd_hibernate_resume_LDADD = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ libsystemd-internal.la \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ libsystemd-shared.la
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# ------------------------------------------------------------------------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
systemd_getty_generator_SOURCES = \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
src/getty-generator/getty-generator.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/man/systemd-hibernate-resume@.service.xml b/man/systemd-hibernate-resume@.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
new file mode 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 0000000000..9b188b0d96
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/man/systemd-hibernate-resume@.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -0,0 +1,81 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ This file is part of systemd.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Copyright 2014 Ivan Shapovalov
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd is free software; you can redistribute it and/or modify it
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ under the terms of the GNU Lesser General Public License as published by
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (at your option) any later version.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd is distributed in the hope that it will be useful, but
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Lesser General Public License for more details.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+-->
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+<refentry id="systemd-hibernate-resume@.service">
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refentryinfo>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <title>systemd-hibernate-resume@.service</title>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <productname>systemd</productname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <authorgroup>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <author>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <contrib>Developer</contrib>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <firstname>Ivan</firstname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <surname>Shapovalov</surname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <email>intelfx100@gmail.com</email>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </author>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </authorgroup>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refentryinfo>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refmeta>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refentrytitle>systemd-hibernate-resume@.service</refentrytitle>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <manvolnum>8</manvolnum>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refmeta>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refnamediv>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refname>systemd-hibernate-resume@.service</refname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refname>systemd-hibernate-resume</refname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refpurpose>Resume from hibernation</refpurpose>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refnamediv>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refsynopsisdiv>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para><filename>systemd-hibernate-resume@.service</filename></para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para><filename>/usr/lib/systemd/systemd-hibernate-resume</filename></para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refsynopsisdiv>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <title>Description</title>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para><filename>systemd-hibernate-resume@.service</filename> is a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ service that initiates hibernation resume from a device
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ containing the resume image. It is instantiated for each
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ device that is configured for resuming from.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para><filename>systemd-hibernate-resume</filename> only supports
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the in-kernel hibernation implementation, known as swsusp.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Internally, it works by writing the major:minor of specified
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ device node to <filename>/sys/power/resume</filename>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Failing to initiate a resume is not an error condition.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ It may mean that there was no resume image (e. g. if the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ system has been simply powered off and not hibernated). In
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ such case, the boot is ordinarily continued.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <title>See Also</title>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <citerefentry><refentrytitle>systemd-hibernate-resume-generator</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+</refentry>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/hibernate-resume/Makefile b/src/hibernate-resume/Makefile
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
new file mode 120000
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 0000000000..d0b0e8e008
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/hibernate-resume/Makefile
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -0,0 +1 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+../Makefile
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
\ No newline at end of file
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
new file mode 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 0000000000..8f68f81f9e
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/src/hibernate-resume/hibernate-resume.c
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -0,0 +1,81 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+/***
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ This file is part of systemd.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Copyright 2014 Ivan Shapovalov
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd is free software; you can redistribute it and/or modify it
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ under the terms of the GNU Lesser General Public License as published by
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (at your option) any later version.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ systemd is distributed in the hope that it will be useful, but
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Lesser General Public License for more details.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+***/
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include <stdio.h>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include <errno.h>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include <sys/types.h>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include <sys/stat.h>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include <unistd.h>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include "log.h"
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include "util.h"
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#include "fileio.h"
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+int main(int argc, char *argv[]) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ struct stat st;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ const char *device;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ _cleanup_free_ char *major_minor = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ int r;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (argc != 2) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("This program expects one argument.");
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_FAILURE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_set_target(LOG_TARGET_AUTO);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_parse_environment();
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_open();
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ umask(0022);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ device = argv[1];
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (stat(device, &st) < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("Failed to stat '%s': %m", device);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_FAILURE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (!S_ISBLK(st.st_mode)) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("Resume device '%s' is not a block device.", device);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_FAILURE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (asprintf(&major_minor, "%d:%d", major(st.st_rdev), minor(st.st_rdev)) < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_oom();
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_FAILURE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ r = write_string_file("/sys/power/resume", major_minor);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_error("Failed to write '%s' to /sys/power/resume: %s", major_minor, strerror(-r));
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_FAILURE;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ }
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ /*
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ * The write above shall not return.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ *
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ * However, failed resume is a normal condition (may mean that there is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ * no hibernation image).
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ */
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ log_info("Could not resume from '%s' (%s).", device, major_minor);
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ return EXIT_SUCCESS;
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+}
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/units/.gitignore b/units/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index d9b60ac0fc..c60f357416 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/units/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/units/.gitignore
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -54,6 +54,7 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-reboot.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-remount-fs.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-resolved.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+/systemd-hibernate-resume@.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-rfkill@.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-shutdownd.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
/systemd-suspend.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/units/systemd-hibernate-resume@.service.in b/units/systemd-hibernate-resume@.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
new file mode 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index 0000000000..6db584dc4d
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- /dev/null
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/units/systemd-hibernate-resume@.service.in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -0,0 +1,20 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# This file is part of systemd.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+#
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# systemd is free software; you can redistribute it and/or modify it
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# under the terms of the GNU Lesser General Public License as published by
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# the Free Software Foundation; either version 2.1 of the License, or
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+# (at your option) any later version.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+[Unit]
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+Description=Resume from hibernation using device %f
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+Documentation=man:systemd-hibernate-resume@.service(8)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+DefaultDependencies=no
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+BindsTo=%i.device
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+Wants=local-fs-pre.target
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+After=%i.device
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+Before=local-fs-pre.target systemd-remount-fs.service systemd-fsck-root.service
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ConditionPathExists=/etc/initrd-release
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+[Service]
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+Type=oneshot
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ExecStart=@rootlibexecdir@/systemd-hibernate-resume %f
|