Skip to content

Commit

Permalink
Added a check if $DESTINATION is actually /
Browse files Browse the repository at this point in the history
Added a check if $DESTINATION is actually /
  • Loading branch information
solisinvictum committed Nov 25, 2021
1 parent 135f306 commit 0913853
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions borgrestore
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ do
# This restores the Snapshot to Destination and at the end it prompts how long it took
time rsync --verbose --archive --itemize-changes --hard-links $RSYNCEXCLUDES --delete "$MOUNTPOINT/$snapshot/" "$DESTINATION"

## Remove some Tempfiles for a clean start from the original System (if selected). This could be unnecessary, but i like it safe.
if [ $LIVESYSTEM = "0" ]
##Realized that the deletion of the content in /tmp and /run could be wrong, if a another destination is choosen. so checking.
if [ $DESTINATION = "/" ]
then
rm -Rf "$DESTINATION"/tmp/*
rm -Rf "$DESTINATION"/run/*
## Remove some Tempfiles for a clean start from the original System (if selected). This could be unnecessary, but i like it safe.
if [ $LIVESYSTEM = "0" ]
then
rm -Rf "$DESTINATION"/tmp/*
rm -Rf "$DESTINATION"/run/*
fi
fi

## Umount the Borg Repo again
umount "$MOUNTPOINT"
echo ""
Expand Down

0 comments on commit 0913853

Please sign in to comment.