Skip to content

Commit

Permalink
Add systemd-volatile
Browse files Browse the repository at this point in the history
Adds support for "systemd.volatile=state" only.
See: #92 (comment)

"GRUB_BTRFS_SYSTEMD_VOLATILE" must be true.
The default init on the snapshot should be "systemd".
The snapshot must have the tag "ro=true".
  • Loading branch information
Antynea authored Nov 26, 2021
1 parent ee3c366 commit b2a3a23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 41_snapshots-btrfs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,16 @@ echo "$@" >> "$grub_directory/grub-btrfs.new"
}

## menu entries
old_kernel_parameters=${kernel_parameters}
make_menu_entries()
{
kernel_parameters="${old_kernel_parameters}"
if [[ "${GRUB_BTRFS_SYSTEMD_VOLATILE}" == true ]] ; then
if [[ $(strings -n7 "$grub_btrfs_mount_point/$snap_dir_name_trim/usr/bin/init" | grep -aEiom1 'upstart|systemd|sysvinit') == systemd ]] \
|| [[ $(strings -n7 "$grub_btrfs_mount_point/$snap_dir_name_trim/sbin/init" | grep -aEiom1 'upstart|systemd|sysvinit') == systemd ]]; then
[[ $(btrfs property get "$grub_btrfs_mount_point/$snap_dir_name_trim" ro) != "ro=false" ]] && kernel_parameters="${kernel_parameters} systemd.volatile=state";
fi
fi
## \" required for snap,kernels,init,microcode with space in their name
entry "submenu '${title_menu}' {
submenu '${title_submenu}' { echo }"
Expand Down

0 comments on commit b2a3a23

Please sign in to comment.