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

updated soprano and soprano-dev (2.8.0 -> 2.9.4)
author Hans-G?nter Theisgen
date Thu Jul 21 06:45:43 2022 +0100 (23 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