wok annotate cookutils/stuff/avoid-hard-link-exist-error.patch @ rev 25444

Up firefox-official (104.0)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Sep 04 18:56:05 2022 +0000 (22 months ago)
parents
children
rev   line source
pascal@24166 1 A void error "cp: cannot create hard link 'file1' to 'file2': file exists"
pascal@24166 2
pascal@24166 3 --- a/cook
pascal@24166 4 +++ b/cook
pascal@24166 5 @@ -423,11 +423,9 @@
pascal@24166 6 # A bit smarter function than the classic `cp` command
pascal@24166 7
pascal@24166 8 copy() {
pascal@24166 9 - if [ "$(stat -c %h -- "$1")" -gt 1 ]; then
pascal@24166 10 - cp -al "$1" "$2" # copy hardlinks
pascal@24166 11 - else
pascal@24166 12 - cp -a "$1" "$2" # copy generic files
pascal@24166 13 - fi
pascal@24166 14 + [ "$(stat -c %h -- "$1")" -gt 1 ] &&
pascal@24166 15 + cp -al "$1" "$2" 2>/dev/null || # copy hardlinks
pascal@24166 16 + cp -a "$1" "$2" # copy generic files
pascal@24166 17 }
pascal@24166 18
pascal@24166 19