Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resume Hook (Hibernation) #41

Merged
merged 6 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Tiny initramfs written in POSIX shell
- ZFS + native encryption support
- LUKS (detached header, key), LVM
- mdev, mdevd, eudev, systemd-udevd
- Resume from swap partition

## Dependencies

Expand Down
8 changes: 8 additions & 0 deletions doc/tinyramfs.5
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ lvm_tag
The tag of your LVM logical volume.\&
.P
.RE
.SS RESUME
.P
resume
.P
.RS 4
The location of your swap partition.\&
.P
.RE
.SS ZFS
.P
zfs_key
Expand Down
6 changes: 6 additions & 0 deletions doc/tinyramfs.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ lvm_tag

The tag of your LVM logical volume.

## RESUME

resume

The location of your swap partition.

## ZFS

zfs_key
Expand Down
8 changes: 8 additions & 0 deletions hook/resume/resume
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# https://shellcheck.net/wiki/SC2154
# shellcheck disable=2154

copy_exec readlink
copy_exec cat
14 changes: 14 additions & 0 deletions hook/resume/resume.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# vim: set ft=sh:
# shellcheck shell=sh
#
# https://shellcheck.net/wiki/SC2154
# shellcheck disable=2154

resolve_device "$resume"

if [ -n "$device" ]; then
dev_link=$(readlink "$device")

cat /sys/class/block/"${dev_link##*/}"/dev > /sys/power/resume || \
panic "failed to resume"
fi