Staubgeborener / klipper-backup

Klipper backup script for manual or automated GitHub backups. Lightweight, pragmatic and comfortable.
https://klipperbackup.xyz
222 stars 46 forks source link

Backup not including subfolders #27

Closed muhquh closed 5 months ago

muhquh commented 5 months ago

Backup is not including subfolders:

cp: -r not specified; omitting directory '/home/pi/printer_data/config/macros'

got a workaround by changing

cp $file $HOME/$backup_folder/ in the sript.sh to

  `cp -r $file $HOME/$backup_folder/`

is there an other way to do it?

Staubgeborener commented 5 months ago

I've looked at it and tested everything - you're right. I have just corrected the issue.

(At the same time, I also found a security issue with the .gitignore file - this was completely ignored in the user repository)

Staubgeborener commented 5 months ago

One step back! @muhquh

I have replaced cp -r with cp again.

Reason: When using cp -r, push errors occur in certain scenarios, all of which should be covered.

Much more relevant, however, is that the user loses control over what is pushed. Let's assume you have a path printer_data/config/ and in it are all kinds of folders that you want to push. But there are also numerous folders and files in it that should not be pushed, for example printer_data/config/mysecrets, then they will all be pushed anyway. The user would be forced to cover all variants in the .gitignore, which complicates everything. If you now want to push the folder printer_data/config/ and printer_data/config/1/ as well as printer_data/config/2/, then please specify these folders separately in the .env (see this) as follows:

path_klipperdata=printer_data/config/*
path_klipperdata=printer_data/config/1/*
path_klipperdata=printer_data/config/2/*

Just pay attention to the wildcard *.

This gives the user much more control over what exactly should be pushed. I hope the explanation of why I am taking this step was understandable.

muhquh commented 5 months ago

Got you. Thanks😃

Staubgeborener commented 5 months ago

Alright, I also added a new Q&A section with this information. (I have the feeling that the wiki needs to be tidied up, and maybe we need a proper doc website at this point...)