diff --git a/config b/config index 159c798..a2e2384 100644 --- a/config +++ b/config @@ -1,6 +1,6 @@ #!/usr/bin/env bash -GRUB_BTRFS_VERSION=4.12-20221123 +GRUB_BTRFS_VERSION=4.12-20221126-fix-snap-dir # Disable grub-btrfs. # Default: "false" diff --git a/grub-btrfsd b/grub-btrfsd index 0f68698..e9f616d 100755 --- a/grub-btrfsd +++ b/grub-btrfsd @@ -32,8 +32,8 @@ setcolors true # normally we want colors sysconfdir="/etc" grub_btrfs_config="${sysconfdir}/default/grub-btrfs/config" # source config file -[[ -f "$grub_btrfs_config" ]] && . "$grub_btrfs_config" -[[ -f "${sysconfdir}/default/grub" ]] && . "${sysconfdir}/default/grub" +[ -f "$grub_btrfs_config" ] && . "$grub_btrfs_config" +[ -f "${sysconfdir}/default/grub" ] && . "${sysconfdir}/default/grub" print_help() { echo "${CYAN}[?] Usage:" @@ -44,8 +44,8 @@ print_help() { echo "Optional arguments:" echo "-c, --no-color Disable colors in output" echo "-l, --log-file Specify a logfile to write to" - echo "-o, --timeshift-old Look for snapshots in directory of Timeshift &2 + err "[!] Flag --timeshift-old requires flag --timeshift-auto" "${RED}" >&2 exit 1 -else +fi vlog "Arguments:" vlog "Snapshot directory: $snapshots" vlog "Timestift autodetection: $timeshift_auto" +vlog "Timeshift old: $timeshift_old" vlog "Logfile: $logfile" if ! [ -d "$snapshots" ] && ! [ ${timeshift_auto} = true ]; then @@ -219,7 +220,7 @@ create_grub_menu() { set_snapshot_dir() { # old timeshift has it's snapshot dir in a different location - if [ ${timeshift_old} = true ]; then + if [ "${timeshift_old}" = true ]; then snapshots="/run/timeshift/backup/timeshift-btrfs/snapshots" else snapshots="/run/timeshift/${timeshift_pid}/backup/timeshift-btrfs/snapshots" diff --git a/manpages/grub-btrfsd.8.man b/manpages/grub-btrfsd.8.man index 5c4ad74..8d4805c 100644 --- a/manpages/grub-btrfsd.8.man +++ b/manpages/grub-btrfsd.8.man @@ -9,7 +9,7 @@ when a new btrfs snapshot is created. .SH "SYNOPSIS" .PP -\fCgrub\-btrfsd [\-h, \-\-help] [\-c, \-\-no\-color] [\-l, \-\-log\-file LOG_FILE] [\-s, \-\-syslog] [\-t, \-\-timeshift\-auto] [\-v, \-\-verbose] SNAPSHOTS_DIR\fP +\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 .SH "DESCRIPTION" .PP @@ -38,6 +38,10 @@ Write to syslog .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. +.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" .PP Let the log of the daemon be more verbose diff --git a/manpages/grub-btrfsd.8.org b/manpages/grub-btrfsd.8.org index 37329af..156233b 100644 --- a/manpages/grub-btrfsd.8.org +++ b/manpages/grub-btrfsd.8.org @@ -10,7 +10,7 @@ grub-btrfsd - An OpenRC daemon to automatically update the grub menu with when a new btrfs snapshot is created. * SYNOPSIS -~grub-btrfsd [-h, --help] [-c, --no-color] [-l, --log-file LOG_FILE] [-s, --syslog] [-t, --timeshift-auto] [-v, --verbose] SNAPSHOTS_DIR~ +~grub-btrfsd [-h, --help] [-c, --no-color] [-l, --log-file LOG_FILE] [-s, --syslog] [-t, --timeshift-auto] [-o, --timeshift-old] [-v, --verbose] SNAPSHOTS_DIR~ * DESCRIPTION Grub-btrfsd is a shell script which is meant to be run as a daemon. @@ -33,6 +33,9 @@ Write to syslog ** ~-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. +** ~-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~ Let the log of the daemon be more verbose