Compare commits

..

1 Commits

Author SHA1 Message Date
Pascal J
593770030a Merge branch 'master' into improve-version-generation 2022-11-26 17:43:15 +01:00
11 changed files with 49 additions and 110 deletions

View File

@@ -92,7 +92,7 @@ grub_directory=${GRUB_BTRFS_GRUB_DIRNAME:-"/boot/grub"}
## Customize BOOT directory, where kernels/initrams/microcode is saved. ## Customize BOOT directory, where kernels/initrams/microcode is saved.
boot_directory=${GRUB_BTRFS_BOOT_DIRNAME:-"/boot"} boot_directory=${GRUB_BTRFS_BOOT_DIRNAME:-"/boot"}
## Customize GRUB-BTRFS.cfg directory, where "grub-btrfs.cfg" file is saved ## Customize GRUB-BTRFS.cfg directory, where "grub-btrfs.cfg" file is saved
grub_btrfs_directory=${GRUB_BTRFS_GBTRFS_DIRNAME:-${grub_directory}} grub_btrfs_directory=${GRUB_BTRFS_GBTRFS_DIRNAME:-"/boot/grub"}
## Customize directory where "grub-btrfs.cfg" file is searched for by grub ## Customize directory where "grub-btrfs.cfg" file is searched for by grub
grub_btrfs_search_directory=${GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME:-"\${prefix}"} grub_btrfs_search_directory=${GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME:-"\${prefix}"}
## Password protection management for submenu ## Password protection management for submenu
@@ -121,7 +121,7 @@ boot_hs=$(${grub_probe} --device ${boot_device} --target="hints_string" 2>/dev/n
boot_fs=$(${grub_probe} --device ${boot_device} --target="fs" 2>/dev/null) # Type filesystem of boot device boot_fs=$(${grub_probe} --device ${boot_device} --target="fs" 2>/dev/null) # Type filesystem of boot device
## Parameters passed to the kernel ## Parameters passed to the kernel
kernel_parameters="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT $GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS" kernel_parameters="$GRUB_CMDLINE_LINUX $GRUB_CMDLINE_LINUX_DEFAULT"
## Mount point location ## Mount point location
grub_btrfs_mount_point=$(mktemp -dt grub-btrfs.XXXXXXXXXX) grub_btrfs_mount_point=$(mktemp -dt grub-btrfs.XXXXXXXXXX)
## Class for theme ## Class for theme
@@ -569,7 +569,7 @@ rm -f "$grub_btrfs_directory/grub-btrfs.new"
> "$grub_btrfs_directory/grub-btrfs.new" # Create a "grub-btrfs.new" file in "grub_btrfs_directory" > "$grub_btrfs_directory/grub-btrfs.new" # Create a "grub-btrfs.new" file in "grub_btrfs_directory"
# Create mount point then mounting # Create mount point then mounting
[[ ! -d $grub_btrfs_mount_point ]] && mkdir -p "$grub_btrfs_mount_point" [[ ! -d $grub_btrfs_mount_point ]] && mkdir -p "$grub_btrfs_mount_point"
mount -o ro,subvolid=5 /dev/disk/by-uuid/"$root_uuid" "$grub_btrfs_mount_point/" > /dev/null mount -o ro,subvolid=5 /dev/disk/by-uuid/"$root_uuid" "$grub_btrfs_mount_point/"
trap "unmount_grub_btrfs_mount_point" EXIT # unmounting mount point on EXIT signal trap "unmount_grub_btrfs_mount_point" EXIT # unmounting mount point on EXIT signal
count_warning_menuentries=0 # Count menuentries count_warning_menuentries=0 # Count menuentries
count_limit_snap=0 # Count snapshots count_limit_snap=0 # Count snapshots

View File

@@ -104,8 +104,6 @@ Disable colors in output.
* `-l / --log-file` * `-l / --log-file`
This arguments specifies a file where grub-btrfsd should write log messages. This arguments specifies a file where grub-btrfsd should write log messages.
* `-s / --syslog` * `-s / --syslog`
* `-o / --timeshift-old`
Look for snapshots in `/run/timeshift/backup/timeshift-btrfs` instead of `/run/timeshift/$PID/backup/timeshift-btrfs.` This is to be used for Timeshift versions <22.06.
* `-t / --timeshift-auto` * `-t / --timeshift-auto`
This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to `/run/timeshift/$PID/backup/timeshift-btrfs`. Where `$PID` is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument `SNAPSHOTS_DIR` has no effect. This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to `/run/timeshift/$PID/backup/timeshift-btrfs`. Where `$PID` is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument `SNAPSHOTS_DIR` has no effect.
* `-v / --verbose` * `-v / --verbose`
@@ -162,6 +160,8 @@ sudo systemctl enable grub-btrfsd
``` ```
##### 💼 Snapshots not in `/.snapshots` ##### 💼 Snapshots not in `/.snapshots`
NOTE: This works also for Timeshift versions < 22.06, the path to watch would be `/run/timeshift/backup/timeshift-btrfs/snapshots`.
By default the daemon is watching the directory `/.snapshots`. If the daemon should watch a different directory, it can be edited with By default the daemon is watching the directory `/.snapshots`. If the daemon should watch a different directory, it can be edited with
```bash ```bash
sudo systemctl edit --full grub-btrfsd sudo systemctl edit --full grub-btrfsd
@@ -184,11 +184,10 @@ EnvironmentFile=/etc/default/grub-btrfs/config
# SNAPSHOTS_DIR Snapshot directory to watch, without effect when --timeshift-auto # SNAPSHOTS_DIR Snapshot directory to watch, without effect when --timeshift-auto
# Optional arguments: # Optional arguments:
# -t, --timeshift-auto Automatically detect Timeshifts snapshot directory # -t, --timeshift-auto Automatically detect Timeshifts snapshot directory
# -o, --timeshift-old Activate for timeshift versions <22.06
# -l, --log-file Specify a logfile to write to # -l, --log-file Specify a logfile to write to
# -v, --verbose Let the log of the daemon be more verbose # -v, --verbose Let the log of the daemon be more verbose
# -s, --syslog Write to syslog # -s, --syslog Write to syslog
ExecStart=/usr/bin/grub-btrfsd --syslog /.snapshots ExecStart=/usr/bin/grub-btrfsd --syslog /path/to/your/snapshot/directory
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -283,19 +282,21 @@ After editing, the file should look like this:
# Distributed under the terms of the GNU General Public License v3 # Distributed under the terms of the GNU General Public License v3
## Where to locate the root snapshots ## Where to locate the root snapshots
snapshots="/.snapshots" # Snapper in the root directory #snapshots="/.snapshots" # Snapper in the root directory
#snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots" # Timeshift < v22.06 #snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots" # Timeshift < v22.06
snapshots="/path/to/your/snapshot/directory"
## Optional arguments to run with the daemon ## Optional arguments to run with the daemon
# Append options to this like this:
# optional_args="--syslog --timeshift-auto --verbose"
# Possible options are: # Possible options are:
# -t, --timeshift-auto Automatically detect Timeshifts snapshot directory for timeshift >= 22.06 # -t, --timeshift-auto Automatically detect Timeshifts snapshot directory for timeshift >= 22.06
# -o, --timeshift-old Look for snapshots in directory of Timeshift <v22.06 (requires --timeshift-auto)
# -l, --log-file Specify a logfile to write to # -l, --log-file Specify a logfile to write to
# -v, --verbose Let the log of the daemon be more verbose # -v, --verbose Let the log of the daemon be more verbose
# -s, --syslog Write to syslog # -s, --syslog Write to syslog
optional_args="--syslog" # Uncomment the line to activate the option
optional_args+="--syslog " # write to syslog by default
#optional_args+="--timeshift-auto "
#optional_args+="--log-file /var/log/grub-btrfsd.log "
#optional_args+="--verbose "
``` ```
After that, the daemon should be restarted with After that, the daemon should be restarted with

15
config
View File

@@ -1,7 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
GRUB_BTRFS_VERSION=4.12-improve-version-generation-2022-11-26T14:03:10+00:00
GRUB_BTRFS_VERSION=4.12-improve-config-2022-12-06T22:10:24+00:00
# Disable grub-btrfs. # Disable grub-btrfs.
# Default: "false" # Default: "false"
@@ -49,13 +48,6 @@ GRUB_BTRFS_VERSION=4.12-improve-config-2022-12-06T22:10:24+00:00
# Default: ("") # Default: ("")
#GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio") #GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")
# Additonal kernel command line parameters that should be passed to the kernel
# when booting a snapshot.
# For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
# or "rd.live.overlay.readonly=1" to the Kernel for booting snapshots read only.
# Default: ""
#GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"
# Comma seperated mount options to be used when booting a snapshot. # Comma seperated mount options to be used when booting a snapshot.
# They can be defined here as well as in the "/" line inside the respective snapshots' # They can be defined here as well as in the "/" line inside the respective snapshots'
# "/etc/fstab" files. Mount options found in both places are combined, and this variable # "/etc/fstab" files. Mount options found in both places are combined, and this variable
@@ -96,6 +88,7 @@ GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/doc
#GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="true" #GRUB_BTRFS_OVERRIDE_BOOT_PARTITION_DETECTION="true"
# Location of the folder containing the "grub.cfg" file. # Location of the folder containing the "grub.cfg" file.
# Use by grub-btrfs to save the file "grub-btrfs.cfg".
# Might be grub2 on some systems. # Might be grub2 on some systems.
# For example, on Fedora with EFI : "/boot/efi/EFI/fedora" # For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
# Default: "/boot/grub" # Default: "/boot/grub"
@@ -107,10 +100,10 @@ GRUB_BTRFS_IGNORE_PREFIX_PATH=("var/lib/docker" "@var/lib/docker" "@/var/lib/doc
#GRUB_BTRFS_BOOT_DIRNAME="/boot" #GRUB_BTRFS_BOOT_DIRNAME="/boot"
# Location where grub-btrfs.cfg should be saved. # Location where grub-btrfs.cfg should be saved.
# Some distributions (like OpenSuSE) store those files at the snapshot directory # Some distributions (like OpenSuSE) store those file at the snapshot directory
# instead of boot. Be aware that this direcory must be available for grub during # instead of boot. Be aware that this direcory must be available for grub during
# startup of the system. # startup of the system.
# Default: $GRUB_BTRFS_GRUB_DIRNAME # Default: "/boot/grub"
#GRUB_BTRFS_GBTRFS_DIRNAME="/boot/grub" #GRUB_BTRFS_GBTRFS_DIRNAME="/boot/grub"
# Location of the directory where Grub searches for the grub-btrfs.cfg file. # Location of the directory where Grub searches for the grub-btrfs.cfg file.

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# Copyright 2022 Pascal Jaeger # Copyright 2022 Pascal Jaeger
# Distributed under the terms of the GNU General Public License v3 # Distributed under the terms of the GNU General Public License v3
# Update GRUB when new BTRFS snapshots are created. # Update GRUB when new BTRFS snapshots are created.
@@ -9,7 +9,6 @@ watchtime=0
logfile=0 logfile=0
snapshots=-1 snapshots=-1
timeshift_auto=false timeshift_auto=false
timeshift_old=false
verbose=false verbose=false
syslog=false syslog=false
@@ -32,8 +31,8 @@ setcolors true # normally we want colors
sysconfdir="/etc" sysconfdir="/etc"
grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config" grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config"
# source config file # source config file
[ -f "$grub_btrfs_config" ] && . "$grub_btrfs_config" [[ -f "$grub_btrfs_config" ]] && . "$grub_btrfs_config"
[ -f "${sysconfdir}/default/grub" ] && . "${sysconfdir}/default/grub" [[ -f "${sysconfdir}/default/grub" ]] && . "${sysconfdir}/default/grub"
print_help() { print_help() {
echo "${CYAN}[?] Usage:" echo "${CYAN}[?] Usage:"
@@ -45,7 +44,6 @@ print_help() {
echo "-c, --no-color Disable colors in output" echo "-c, --no-color Disable colors in output"
echo "-l, --log-file Specify a logfile to write to" echo "-l, --log-file Specify a logfile to write to"
echo "-s, --syslog Write to syslog" echo "-s, --syslog Write to syslog"
echo "-o, --timeshift-old Look for snapshots in directory of Timeshift <v22.06 (requires --timeshift-auto)"
echo "-t, --timeshift-auto Automatically detect Timeshifts snapshot directory" echo "-t, --timeshift-auto Automatically detect Timeshifts snapshot directory"
echo "-v, --verbose Let the log of the daemon be more verbose" echo "-v, --verbose Let the log of the daemon be more verbose"
echo "-h, --help Display this message" echo "-h, --help Display this message"
@@ -99,9 +97,6 @@ while getopts :l:ctvsh-: opt; do
timeshift-auto) timeshift-auto)
timeshift_auto=true timeshift_auto=true
;; ;;
timeshift-old)
timeshift_old=true
;;
verbose) verbose)
verbose=true verbose=true
;; ;;
@@ -130,9 +125,6 @@ while getopts :l:ctvsh-: opt; do
t) t)
timeshift_auto=true timeshift_auto=true
;; ;;
o)
timeshift_old=true
;;
v) v)
verbose=true verbose=true
;; ;;
@@ -158,7 +150,7 @@ shift $(( OPTIND - 1 ))
snapshots="${1}" snapshots="${1}"
# check if inotify exists, see issue #227 # check if inotify exists, see issue #227
if ! command -v inotifywait >/dev/null 2>&1; then if ! command -v inotifywait &> /dev/null; then
err "[!] inotifywait was not found, exiting. Is inotify-tools installed?" "${RED}" >&2 err "[!] inotifywait was not found, exiting. Is inotify-tools installed?" "${RED}" >&2
exit 1 exit 1
fi fi
@@ -176,15 +168,9 @@ else
inotify_qiet_flag=" -q -q " inotify_qiet_flag=" -q -q "
fi fi
if [ ${timeshift_auto} = false ] && [ ${timeshift_old} = true ]; then
err "[!] Flag --timeshift-old requires flag --timeshift-auto" "${RED}" >&2
exit 1
fi
vlog "Arguments:" vlog "Arguments:"
vlog "Snapshot directory: $snapshots" vlog "Snapshot directory: $snapshots"
vlog "Timestift autodetection: $timeshift_auto" vlog "Timestift autodetection: $timeshift_auto"
vlog "Timeshift old: $timeshift_old"
vlog "Logfile: $logfile" vlog "Logfile: $logfile"
if ! [ -d "$snapshots" ] && ! [ ${timeshift_auto} = true ]; then if ! [ -d "$snapshots" ] && ! [ ${timeshift_auto} = true ]; then
@@ -218,15 +204,6 @@ create_grub_menu() {
fi fi
} }
set_snapshot_dir() {
# old timeshift has it's snapshot dir in a different location
if [ "${timeshift_old}" = true ]; then
snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots"
else
snapshots="/run/timeshift/${timeshift_pid}/backup/timeshift-btrfs/snapshots"
fi
}
# start the actual daemon # start the actual daemon
vlog "Snapshot dir watchtimeout: $watchtime" vlog "Snapshot dir watchtimeout: $watchtime"
vlog "Entering infinite while" "${GREEN}" vlog "Entering infinite while" "${GREEN}"
@@ -240,7 +217,7 @@ while true; do
fi fi
timeshift_pid=$(ps ax | awk '{sub(/.*\//, "", $5)} $5 ~ /timeshift/ {print $1}') timeshift_pid=$(ps ax | awk '{sub(/.*\//, "", $5)} $5 ~ /timeshift/ {print $1}')
if [ "${#timeshift_pid}" -gt 0 ]; then if [ "${#timeshift_pid}" -gt 0 ]; then
set_snapshot_dir snapshots="/run/timeshift/${timeshift_pid}/backup/timeshift-btrfs/snapshots"
log "detected running Timeshift at daemon startup, PID is: $timeshift_pid" log "detected running Timeshift at daemon startup, PID is: $timeshift_pid"
vlog "new snapshots directory is $snapshots" vlog "new snapshots directory is $snapshots"
else else
@@ -248,7 +225,7 @@ while true; do
inotifywait ${inotify_qiet_flag} -e create -e delete /run/timeshift && { inotifywait ${inotify_qiet_flag} -e create -e delete /run/timeshift && {
sleep 1 sleep 1
timeshift_pid=$(ps ax | awk '{sub(/.*\//, "", $5)} $5 ~ /timeshift/ {print $1}') timeshift_pid=$(ps ax | awk '{sub(/.*\//, "", $5)} $5 ~ /timeshift/ {print $1}')
set_snapshot_dir snapshots="/run/timeshift/${timeshift_pid}/backup/timeshift-btrfs/snapshots"
log "detected Timeshift startup, PID is: $timeshift_pid" "${CYAN}" log "detected Timeshift startup, PID is: $timeshift_pid" "${CYAN}"
vlog "new snapshots directory is $snapshots" "${CYAN}" vlog "new snapshots directory is $snapshots" "${CYAN}"
(create_grub_menu) # create the grub menu once immidiatly in a forking process. Snapshots from commandline using timeshift --create need this (create_grub_menu) # create the grub menu once immidiatly in a forking process. Snapshots from commandline using timeshift --create need this

View File

@@ -6,12 +6,13 @@ snapshots="/.snapshots" # Snapper in the root directory
#snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots" # Timeshift < v22.06 #snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots" # Timeshift < v22.06
## Optional arguments to run with the daemon ## Optional arguments to run with the daemon
# Append options to this like this:
# optional_args="--syslog --timeshift-auto --verbose"
# Possible options are: # Possible options are:
# -t, --timeshift-auto Automatically detect Timeshifts snapshot directory for timeshift >= 22.06 # -t, --timeshift-auto Automatically detect Timeshifts snapshot directory for timeshift >= 22.06
# -o, --timeshift-old Look for snapshots in directory of Timeshift <v22.06 (requires --timeshift-auto)
# -l, --log-file Specify a logfile to write to # -l, --log-file Specify a logfile to write to
# -v, --verbose Let the log of the daemon be more verbose # -v, --verbose Let the log of the daemon be more verbose
# -s, --syslog Write to syslog # -s, --syslog Write to syslog
optional_args="--syslog" # Uncomment the line to activate the option
optional_args+="--syslog " # write to syslog by default
#optional_args+="--timeshift-auto "
#optional_args+="--log-file /var/log/grub-btrfsd.log "
#optional_args+="--verbose "

View File

@@ -13,7 +13,6 @@ EnvironmentFile=/etc/default/grub-btrfs/config
# SNAPSHOTS_DIR Snapshot directory to watch, without effect when --timeshift-auto # SNAPSHOTS_DIR Snapshot directory to watch, without effect when --timeshift-auto
# Optional arguments: # Optional arguments:
# -t, --timeshift-auto Automatically detect Timeshifts snapshot directory # -t, --timeshift-auto Automatically detect Timeshifts snapshot directory
# -o, --timeshift-old Activate for timeshift versions <22.06
# -l, --log-file Specify a logfile to write to # -l, --log-file Specify a logfile to write to
# -v, --verbose Let the log of the daemon be more verbose # -v, --verbose Let the log of the daemon be more verbose
# -s, --syslog Write to syslog # -s, --syslog Write to syslog

View File

@@ -39,11 +39,7 @@ You notice that the name of the `hook` must match the name of the 2 installed fi
Re-generate your initramfs Re-generate your initramfs
`mkinitcpio -P` (option -P means, all preset present in `/etc/mkinitcpio.d`) `mkinitcpio -P` (option -P means, all preset present in `/etc/mkinitcpio.d`)
#### Dracut based distros
Distributions that use Dracut to make their initramfs (many of the Fedora based Distros) simply have to pass either `rd.live.overlay.readonly=1` (to boot into the snapshot read only) or `rd.live.overlay.overlayfs=1` (to act like a livedisk, that is files can be changed but changes will be lost on the next boot) to their kernel command line in grub.
Grub-btrfs provides the variable `GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS` to add any command to the kernel command line. Set it to `GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"` to make snapshots immutable when booted into.
After changing this run `sudo /etc/grub.d/41_snapshots-btrfs` to generate a new snapshot-submenu with the parameter added.
#### Other distribution #### Other distribution
Refer to your distribution's documentation or contribute to this project to add a paragraph. Refer to your distribution's documentation
or contribute to this project to add a paragraph.
# #

View File

@@ -1,4 +1,4 @@
.TH "grub-btrfs" "8" .TH "grub-btrfs" "8"
.SH "NAME" .SH "NAME"
.PP .PP
@@ -114,17 +114,6 @@ Example: \fCGRUB_BTRFS_NKERNEL=("kernel\-5.19.4\-custom" "vmlinux\-5.19.4\-custo
\fCGRUB_BTRFS_NINIT=("initramfs\-5.19.4\-custom.img" "initrd\-5.19.4\-custom.img" "otherinit\-5.19.4\-custom.gz")\fP \fCGRUB_BTRFS_NINIT=("initramfs\-5.19.4\-custom.img" "initrd\-5.19.4\-custom.img" "otherinit\-5.19.4\-custom.gz")\fP
\fCGRUB_BTRFS_CUSTOM_MICROCODE=("custom\-ucode.img" "custom\-uc.img "custom_ucode.cpio")\fP \fCGRUB_BTRFS_CUSTOM_MICROCODE=("custom\-ucode.img" "custom\-uc.img "custom_ucode.cpio")\fP
.SS "\fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS\fP"
.PP
Additonal kernel command line parameters that should be passed to the kernelwhen
booting a snapshot.
For dracut based distros this could be useful to pass “rd.live.overlay.overlayfs=1”
or “rd.live.overlay.readonly=1” to the Kernel for booting read only snapshots.
.IP \(em 4
Default: “”
.IP \(em 4
Example: \fCGRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"\fP
.SS "SNAPSHOT FILTERING" .SS "SNAPSHOT FILTERING"
.SS "\fCGRUB_BTRFS_IGNORE_SPECIFIC_PATH\fP" .SS "\fCGRUB_BTRFS_IGNORE_SPECIFIC_PATH\fP"
.PP .PP
@@ -179,6 +168,7 @@ Example: \fCGRUB_BTRFS_BOOT_DIRNAME="/"\fP
.SS "\fCGRUB_BTRFS_GRUB_DIRNAME\fP" .SS "\fCGRUB_BTRFS_GRUB_DIRNAME\fP"
.PP .PP
Location of the folder containing the “grub.cfg” file. Location of the folder containing the “grub.cfg” file.
Used by grub-btrfs to save the file “grub-btrfs.cfg”.
Might be grub2 on some systems. Might be grub2 on some systems.
For example, on Fedora with EFI : “/boot/efi/EFI/fedora” For example, on Fedora with EFI : “/boot/efi/EFI/fedora”
.IP \(em 4 .IP \(em 4
@@ -193,9 +183,9 @@ Some distributions (like OpenSuSE) store those file at the snapshot directory
instead of boot. Be aware that this direcory must be available for grub during instead of boot. Be aware that this direcory must be available for grub during
startup of the system. startup of the system.
.IP \(em 4 .IP \(em 4
Default: \fC$GRUB_BTRFS_GRUB_DIRNAME\fP Default: “/boot/grub”
.IP \(em 4 .IP \(em 4
Example: \fCGRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"\fP Example GRUB\d\s-2BTRFS\s+2\u\d\s-2GBTRFS\s+2\u\d\s-2DIRNAME\s+2\u=“/boot/grub”
.SS "\fCGRUB_BTRFS_GBTRFS_SEARCH_DIRNAME\fP" .SS "\fCGRUB_BTRFS_GBTRFS_SEARCH_DIRNAME\fP"
.PP .PP
@@ -212,7 +202,8 @@ NOTE: If variables of grub are used here like ${prefix}, they need to be escaped
.PP .PP
with `$\` before the `$` with `$\` before the `$`
.IP \(em 4 .IP \(em 4
Example: \fCGRUB_BTRFS_GBTRFS_SEARCH_DIRNAME="\${prefix}"\fP Example: GRUB\d\s-2BTRFS\s+2\u\d\s-2GBTRFS\s+2\u\d\s-2SEARCH\s+2\u\d\s-2DIRNAME\s+2\u=“\${prefix}
.SS "\fCGRUB_BTRFS_MKCONFIG\fP" .SS "\fCGRUB_BTRFS_MKCONFIG\fP"
.PP .PP
@@ -252,9 +243,7 @@ and this comment \fIhttps://github.com/Antynea/grub-btrfs/issues/95#issuecomment
Add authorized usernames separate by comma (userfoo,userbar). Add authorized usernames separate by comma (userfoo,userbar).
When Grubs password protection is enabled, the superuser is authorized by default, it is not necessary to add it When Grubs password protection is enabled, the superuser is authorized by default, it is not necessary to add it
.IP \(em 4 .IP \(em 4
Default: “ Default: “- Example: \fCGRUB_BTRFS_PROTECTION_AUTHORIZED_USERS="userfoo,userbar"\fP
.IP \(em 4
Example: \fCGRUB_BTRFS_PROTECTION_AUTHORIZED_USERS="userfoo,userbar"\fP
.SS "\fCGRUB_BTRFS_DISABLE_PROTECTION_SUBMENU\fP" .SS "\fCGRUB_BTRFS_DISABLE_PROTECTION_SUBMENU\fP"
.PP .PP

View File

@@ -1,6 +1,6 @@
#+title: grub-btrfs #+title: grub-btrfs
#+author: Pascal Jaeger #+author: Pascal Jaeger
#+MAN_CLASS_OPTIONS: :section-id "8" #+man_class_option: :sectionid 8
* NAME * NAME
grub-btrfs - Automatically add btrfs-Snapshots as a Grub submenu grub-btrfs - Automatically add btrfs-Snapshots as a Grub submenu
@@ -83,14 +83,6 @@ Customs kernel, initramfs and microcodes that are not detected can be added in t
~GRUB_BTRFS_NINIT=("initramfs-5.19.4-custom.img" "initrd-5.19.4-custom.img" "otherinit-5.19.4-custom.gz")~ ~GRUB_BTRFS_NINIT=("initramfs-5.19.4-custom.img" "initrd-5.19.4-custom.img" "otherinit-5.19.4-custom.gz")~
~GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")~ ~GRUB_BTRFS_CUSTOM_MICROCODE=("custom-ucode.img" "custom-uc.img "custom_ucode.cpio")~
*** ~GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS~
Additonal kernel command line parameters that should be passed to the kernelwhen
booting a snapshot.
For dracut based distros this could be useful to pass "rd.live.overlay.overlayfs=1"
or "rd.live.overlay.readonly=1" to the Kernel for booting read only snapshots.
- Default: ""
- Example: ~GRUB_BTRFS_SNAPSHOT_KERNEL_PARAMETERS="rd.live.overlay.overlayfs=1"~
** SNAPSHOT FILTERING ** SNAPSHOT FILTERING
*** ~GRUB_BTRFS_IGNORE_SPECIFIC_PATH~ *** ~GRUB_BTRFS_IGNORE_SPECIFIC_PATH~
@@ -131,6 +123,7 @@ Used by "grub-btrfs" to detect the boot partition and the location of kernels, i
*** ~GRUB_BTRFS_GRUB_DIRNAME~ *** ~GRUB_BTRFS_GRUB_DIRNAME~
Location of the folder containing the "grub.cfg" file. Location of the folder containing the "grub.cfg" file.
Used by grub-btrfs to save the file "grub-btrfs.cfg".
Might be grub2 on some systems. Might be grub2 on some systems.
For example, on Fedora with EFI : "/boot/efi/EFI/fedora" For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
- Default: "/boot/grub" - Default: "/boot/grub"
@@ -141,8 +134,8 @@ For example, on Fedora with EFI : "/boot/efi/EFI/fedora"
Some distributions (like OpenSuSE) store those file at the snapshot directory Some distributions (like OpenSuSE) store those file at the snapshot directory
instead of boot. Be aware that this direcory must be available for grub during instead of boot. Be aware that this direcory must be available for grub during
startup of the system. startup of the system.
- Default: ~$GRUB_BTRFS_GRUB_DIRNAME~ - Default: "/boot/grub"
- Example: ~GRUB_BTRFS_GBTRFS_DIRNAME="/.snapshots"~ - Example GRUB_BTRFS_GBTRFS_DIRNAME="/boot/grub"
*** ~GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME~ *** ~GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME~
Location of the directory where Grub searches for the grub-btrfs.cfg file. Location of the directory where Grub searches for the grub-btrfs.cfg file.
@@ -153,13 +146,11 @@ startup of the system.
installed. (like /boot/grub, /boot/efi/grub)) installed. (like /boot/grub, /boot/efi/grub))
- NOTE: If variables of grub are used here like ${prefix}, they need to be escaped - NOTE: If variables of grub are used here like ${prefix}, they need to be escaped
with `\` before the `$` with `\` before the `$`
- Example: ~GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME="\${prefix}"~ - Example: GRUB_BTRFS_GBTRFS_SEARCH_DIRNAME="\${prefix}"
*** ~GRUB_BTRFS_MKCONFIG~ *** ~GRUB_BTRFS_MKCONFIG~
Name/path of the command to generate the grub menu, used by Name/path of the command to generate the grub menu, used by "grub-btrfs.service"
#+BEGIN_MAN
.BR grub-btrfsd (8)
#+END_MAN
Might be 'grub2-mkconfig' on some systems (e.g. Fedora) Might be 'grub2-mkconfig' on some systems (e.g. Fedora)
Default paths are /sbin:/bin:/usr/sbin:/usr/bin, if your path is missing, report it on the upstream project. Default paths are /sbin:/bin:/usr/sbin:/usr/bin, if your path is missing, report it on the upstream project.
You can use the name of the command only or full the path. You can use the name of the command only or full the path.
@@ -186,8 +177,7 @@ Refer to the Grub documentation https://www.gnu.org/software/grub/manual/grub/gr
and this comment https://github.com/Antynea/grub-btrfs/issues/95#issuecomment-682295660 and this comment https://github.com/Antynea/grub-btrfs/issues/95#issuecomment-682295660
Add authorized usernames separate by comma (userfoo,userbar). Add authorized usernames separate by comma (userfoo,userbar).
When Grub's password protection is enabled, the superuser is authorized by default, it is not necessary to add it When Grub's password protection is enabled, the superuser is authorized by default, it is not necessary to add it
- Default: "" - Default: "- Example: ~GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS="userfoo,userbar"~
- Example: ~GRUB_BTRFS_PROTECTION_AUTHORIZED_USERS="userfoo,userbar"~
*** ~GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU~ *** ~GRUB_BTRFS_DISABLE_PROTECTION_SUBMENU~
Disable authentication support for submenu of Grub-btrfs only (--unrestricted) Disable authentication support for submenu of Grub-btrfs only (--unrestricted)

View File

@@ -1,4 +1,4 @@
.TH "grub-btrfsd" "8" .TH "grub-btrfsd" "8"
.SH "NAME" .SH "NAME"
.PP .PP
@@ -9,7 +9,7 @@ when a new btrfs snapshot is created.
.SH "SYNOPSIS" .SH "SYNOPSIS"
.PP .PP
\fCgrub\-btrfsd [\-h, \-\-help] [\-c, \-\-no\-color] [\-l, \-\-log\-file LOG_FILE] [\-s, \-\-syslog] [\-t, \-\-timeshift\-auto] [\-o, \-\-timeshift\-old] [\-v, \-\-verbose] SNAPSHOTS_DIR\fP \fCgrub\-btrfsd [\-h, \-\-help] [\-c, \-\-no\-color] [\-l, \-\-log\-file LOG_FILE] [\-s, \-\-syslog] [\-t, \-\-timeshift\-auto] [\-v, \-\-verbose] SNAPSHOTS_DIR\fP
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
@@ -38,10 +38,6 @@ Write to syslog
.PP .PP
This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to \fC/run/timeshift/$PID/backup/timeshift\-btrfs\fP. Where \fC$PID\fP is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument \fCSNAPSHOTS_DIR\fP has no effect. This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to \fC/run/timeshift/$PID/backup/timeshift\-btrfs\fP. Where \fC$PID\fP is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument \fCSNAPSHOTS_DIR\fP has no effect.
.SS "\fC\-o / \-\-timeshift\-old\fP"
.PP
Look for snapshots in \fC/run/timeshift/backup/timeshift\-btrfs\fP instead of \fC/run/timeshift/$PID/backup/timeshift\-btrfs\fP. This is to be used for Timeshift versions <22.06.
.SS "\fC\-v / \-\-verbose\fP" .SS "\fC\-v / \-\-verbose\fP"
.PP .PP
Let the log of the daemon be more verbose Let the log of the daemon be more verbose

View File

@@ -1,6 +1,6 @@
#+title: grub-btrfsd #+title: grub-btrfsd
#+author: Pascal Jaeger #+author: Pascal Jaeger
#+MAN_CLASS_OPTIONS: :section-id "8" #+man_class_option: :sectionid 8
* NAME * NAME
grub-btrfsd - An OpenRC daemon to automatically update the grub menu with grub-btrfsd - An OpenRC daemon to automatically update the grub menu with
@@ -10,7 +10,7 @@ grub-btrfsd - An OpenRC daemon to automatically update the grub menu with
when a new btrfs snapshot is created. when a new btrfs snapshot is created.
* SYNOPSIS * SYNOPSIS
~grub-btrfsd [-h, --help] [-c, --no-color] [-l, --log-file LOG_FILE] [-s, --syslog] [-t, --timeshift-auto] [-o, --timeshift-old] [-v, --verbose] SNAPSHOTS_DIR~ ~grub-btrfsd [-h, --help] [-c, --no-color] [-l, --log-file LOG_FILE] [-s, --syslog] [-t, --timeshift-auto] [-v, --verbose] SNAPSHOTS_DIR~
* DESCRIPTION * DESCRIPTION
Grub-btrfsd is a shell script which is meant to be run as a daemon. Grub-btrfsd is a shell script which is meant to be run as a daemon.
@@ -33,9 +33,6 @@ Write to syslog
** ~-t / --timeshift-auto~ ** ~-t / --timeshift-auto~
This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to ~/run/timeshift/$PID/backup/timeshift-btrfs~. Where ~$PID~ is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument ~SNAPSHOTS_DIR~ has no effect. This is a flag to activate the auto detection of the path where Timeshift stores snapshots. Newer versions (>=22.06) of Timeshift mount their snapshots to ~/run/timeshift/$PID/backup/timeshift-btrfs~. Where ~$PID~ is the process ID of the currently running Timeshift session. The PID is changing every time Timeshift is opened. grub-btrfsd can automatically take care of the detection of the correct PID and directory if this flag is set. In this case the argument ~SNAPSHOTS_DIR~ has no effect.
** ~-o / --timeshift-old~
Look for snapshots in ~/run/timeshift/backup/timeshift-btrfs~ instead of ~/run/timeshift/$PID/backup/timeshift-btrfs~. This is to be used for Timeshift versions <22.06.
** ~-v / --verbose~ ** ~-v / --verbose~
Let the log of the daemon be more verbose Let the log of the daemon be more verbose