Staubgeborener / klipper-backup

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

cp: unrecognized option '--parents' #74

Closed skabashnyuk closed 4 months ago

skabashnyuk commented 4 months ago

Code of Conduct

What happened

Error

cp: unrecognized option '--parents'
BusyBox v1.36.1 (2024-02-24 17:59:02 UTC) multi-call binary.

Usage: cp [-arPLHpfinlsTu] SOURCE DEST
or: cp [-arPLHpfinlsu] SOURCE... { -t DIRECTORY | DIRECTORY }

Copy SOURCEs to DEST

    -a  Same as -dpR
    -R,-r   Recurse
    -d,-P   Preserve symlinks (default if -R)
    -L  Follow all symlinks
    -H  Follow symlinks on command line
    -p  Preserve file attributes if possible
    -f  Overwrite
    -i  Prompt before overwrite
    -n  Don't overwrite
    -l,-s   Create (sym)links
    -T  Refuse to copy if DEST is a directory
    -t DIR  Copy all SOURCEs into DIR
    -u  Copy only newer files

during execution of ./klipper-backup/script.sh script

What did you expect to happen

Successful backup.

How to reproduce

Additional information

No response

Staubgeborener commented 4 months ago

Is busybox / entware even handling the --parents parameter in cp command? I mean, I think macOS systems (and other BSD systems?) also have problems using cp --parents. I think --parents only works on non-POSIX systems but not sure.

Could you try to replace the cp -r --parents "$file" "$backup_path/" code in line 105 with the following: rsync -R "$file" "$backup_path/"

Please tell me if this works and i will create an update for this behaviour.

skabashnyuk commented 4 months ago

Works like a charm.

Знімок екрана 2024-03-02 о 22 46 20 Знімок екрана 2024-03-02 о 22 46 10
Tylerjet commented 4 months ago

pr made 👍

Staubgeborener commented 4 months ago

Good. Could you do me a favor and replace this new line now with this here


if ! cp --parents "$file" "$backup_path/"; then
    rsynch -R "$file" "$backup_path/"
fi

Does this also work?

Staubgeborener commented 4 months ago

There is a new update available with this fix.