Skip to content

Commit c3c0426

Browse files
committed
Fix baksnapper and baksnapperd
Fix list-snapshots to get only read-only snapshots. Fix shellcheck warnings.
1 parent 35b5379 commit c3c0426

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

baksnapper.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ p_all=${p_all=0}
277277
[[ -z $p_dest ]] && error "No path specified!"
278278

279279
function exit-msg {
280+
# shellcheck disable=SC2317
280281
notify-send -u critical "Done backing up $p_config. Safe to turn off computer."
281282
}
282283

@@ -517,7 +518,7 @@ function backup {
517518
if [[ "${#common[@]}" == 0 ]]
518519
then
519520
echo "Initialize backup"
520-
if [ $p_all -eq 1 ]
521+
if [ "$p_all" -eq 1 ]
521522
then
522523
# Send the first snapshot as a whole then the rest will be
523524
# sent incremental.

baksnapperd.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ case "$1" in
3131
version) # Return what version of the API it's using, always one integer
3232
echo 2
3333
;;
34-
list-snapshots) # List snapshots at backup location
34+
list-snapshots) # List snapshots at src/dest location
3535
shift
36-
find "$1" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort -g
36+
find "$1" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort -g | xargs -I{} sh -c 'btrfs prop get "/.snapshots/{}/snapshot" ro | grep -q true && echo {}'
3737
;;
3838
get-snapper-root) # Return the location of the .snapshots directory
3939
shift
@@ -121,6 +121,7 @@ case "$1" in
121121
error "$1/latest exists and is not a symbolic link. Link is not created."
122122
fi
123123
fi
124+
# shellcheck disable=SC2045
124125
for dir in $( ls -d1v "$1"/* ); do
125126
if [[ -d "$dir/snapshot" && ! -h "$dir" ]]; then
126127
snapshots+=("$dir")

0 commit comments

Comments
 (0)