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