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

updated libplist and libplist-dev (2.0.0 -> 2.2.0)
author Hans-G?nter Theisgen
date Wed Mar 23 11:26:00 2022 +0100 (2022-03-23)
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