mirror of
https://github.com/Antynea/grub-btrfs.git
synced 2026-03-04 04:35:00 +08:00
grub-btrfsd: Check if all dirs exist
Signed-off-by: Pascal Jäger <pascal.jaeger@leimstift.de>
This commit is contained in:
2
config
2
config
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
GRUB_BTRFS_VERSION=4.12-master-2023-04-05T15:10:49+00:00
|
||||
GRUB_BTRFS_VERSION=4.12-master-2023-04-05T15:26:58+00:00
|
||||
|
||||
# Disable grub-btrfs.
|
||||
# Default: "false"
|
||||
|
||||
19
grub-btrfsd
19
grub-btrfsd
@@ -7,7 +7,6 @@
|
||||
timeshift_pid=-1
|
||||
watchtime=0
|
||||
logfile=0
|
||||
snapshots=-1
|
||||
timeshift_auto=false
|
||||
timeshift_old=false
|
||||
verbose=false
|
||||
@@ -174,7 +173,7 @@ while getopts :l:ctvrsh-: opt; do
|
||||
done
|
||||
shift $(( OPTIND - 1 ))
|
||||
|
||||
snapshots="${1}"
|
||||
snapdirs=( "${@}" )
|
||||
|
||||
# check if inotify exists, see issue #227
|
||||
if ! command -v inotifywait >/dev/null 2>&1; then
|
||||
@@ -207,16 +206,21 @@ if [ ${timeshift_auto} = false ] && [ ${timeshift_old} = true ]; then
|
||||
fi
|
||||
|
||||
vlog "Arguments:"
|
||||
vlog "Snapshot directories: $snapshots"
|
||||
vlog "Snapshot directories: ${snapdirs[*]}"
|
||||
vlog "Timestift autodetection: $timeshift_auto"
|
||||
vlog "Timeshift old: $timeshift_old"
|
||||
vlog "Logfile: $logfile"
|
||||
vlog "Recursive: $recursive"
|
||||
|
||||
if ! [ -d "$snapshots" ] && ! [ ${timeshift_auto} = true ]; then
|
||||
err "[!] No directory found at ${snapshots}" "${RED}" >&2
|
||||
err "[!] Please specify a valid snapshot directory" "${RED}" >&2
|
||||
exit 1
|
||||
if ! [ ${timeshift_auto} = true ]; then
|
||||
for snapdir in "${snapdirs[@]}"
|
||||
do
|
||||
if ! [ -d ${snapdir} ]; then
|
||||
err "[!] No directory found at ${snapdir}" "${RED}" >&2
|
||||
err "[!] Please specify a valid snapshot directory" "${RED}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ${timeshift_auto} = true ]; then
|
||||
@@ -314,7 +318,6 @@ if [ ${timeshift_auto} = true ] ; then
|
||||
daemon_function &
|
||||
else
|
||||
# for all dirs that got passed to the script, start a new fork with that dir
|
||||
snapdirs=( "${@}" )
|
||||
for snapdir in "${snapdirs[@]}"
|
||||
do
|
||||
vlog "starting daemon watching $snapdir..."
|
||||
|
||||
Reference in New Issue
Block a user