Hi Guys,

I wanted to share a little script that might interest one or two of you. Is nothing complicated and quite simple and amteur…

You can get most of the info from github[1], and this forum thread[2].



1 Like

Word of advice: always quote all of your paths, or it will lead to disaster (a lot of people use spaces in their path).

For example, instead of:

 time rsync --verbose --archive --itemize-changes --hard-links $RSYNCEXCLUDES --delete $MOUNTPOINT/$snapshot/ $DESTINATION


 time rsync --verbose --archive --itemize-changes --hard-links "$RSYNCEXCLUDES" --delete "$MOUNTPOINT/$snapshot/" "$DESTINATION"

This is especially valid point when doing stuff like rm…but to be on a safe side just quote all paths.



Yeah, that reminds me of this:

A single space in an unquoted path passed to rm can cause devastating data loss! Never drink and script! :rofl:


Thanks for that advice. I change that.

But would “–exclude=/mnt --exclude=/sys --exclude=/whatever” work? because the hole command is quoted?

shouldnt it be better --exclude="/mnt" --exclude="/sys" --exclude="/whatever" ?

1 Like

Yes, you quote only the path(s), not whole command

P.S. @lunainvictum Don’t forget all the other paths, it was just one example :wink:

Thanks again! :slight_smile:

Have done it.

Would be nice if you can check it if this is ok with you :slight_smile:


Added too.


I just realized too that it isnt possible anymore to upload a AUR Package to the Arch AUR with a browser. Last time (13 Years ago) i uploaded a AUR Package for a Brother Printer (drivers).

It would be nice, if somebody could help me to edit my PKG in this way, that it could be uploaded to AUR and its pulls the last git and to upload this PKG to AUR :slight_smile:

It’s better :upside_down_face:

If $DESTINATION can be anything other than /, and seems that it can since it’s variable in your conf, also do:

line 43

if [ "$DESTINATION" = "/" ]

Also you forgot to do line 40 (hard links can also have spaces / weird characters?)


Definitely do line 15, coz those paths are variables:

borg mount "$BORGREPO" "$MOUNTPOINT"

Not sure if line 4 can be changed? But still, if someone decides to run this script as portable and change it to something with spaces in path, i’d wrap it too, just in case:

source "/etc/borgrestore/borgrestore.conf"

Just wrap paths always, you never know what someone might do or have in path :sweat_smile:

Those are just obvious stuff which can go wrong, but other than that you can just test it inside VM with paths that have spaces and see if it works as you intended :wink:

AUR should work i think, are you logged in?

Ha! Here i was faster! :smiley:

Yeah, that not works. Im testing right now (with --dry-run). And then rsync ignores the excludes. " didnt work right here. Im searching on the internet what would be correct.

1 Like

Oh i didn’t realize at first, you want to pass multiple options in this variable according to example in conf?

RSYNCEXCLUDES="--exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lost+found --exclude=/dev --exclude=/media --exclude=/run --exclude=/tmp"

Yeah that would be a problem, not sure what to advice (well actually i just don’t remember), maybe @Kresimir would give a hand?

Yes, because so works rsync. would be nicer if rsync would allow --exclude="/mnt,/sys,/anotherpath" for example.

But im right now in the #rsync irc channel and waiting for response.

And searching how to quote command options properly.

For rsync you need multiple --exclude="PATH" options if you wish to exclude multiple paths.

1 Like

Ha! yes.

But it seems, you didnt need multiple! Found a solution. im testing and implementing right now.

Yes, but what i mean is basically how to pass

RSYNCEXCLUDES="--exclude=/mnt --exclude=/proc --exclude=/sys --exclude=/lost+found --exclude=/dev --exclude=/media --exclude=/run --exclude=/tmp"

which can have custom excludes with spaces and should be properly quoted, and then evaluate it inside line 40 properly so it would actually work…?

P.S. It’s bash question, not rsync :blush:

You can use something like this:

rsync $(printf -- "--exclude=\"%s\" " "${EXCLUDE_PATHS[@]}") # other options here
1 Like

Thx, that is exactly what i was trying to remember :laughing:
Need to write it down now…


So, fixed/got it:

Thank you guys again :slight_smile:

(this is really fun to work on this little piece of sh*t :smiley: )

1 Like

Forgot to answer this.

Yes, im logged in in the AUR. But the upload button is missing. But thats wanted. In the Wiki is written that uploading a package to AUR is now only possible over git/ssh if i understand it right. I give it a look later how to do it right.

1 Like

For the guys who want to follow it, I have now implemented a menu that simplifies the selection of the respective snapshot.

And few Options:

1 Like

Few litle improvements

  • Be sure vorta isnt running
  • Added --progress to rsync to show how fast rsync is working
  • Ask the user if he wants to reboot, and force the reboot with -ff so system reboots even without systemd active