wok view cookutils/stuff/avoid-hard-link-exist-error.patch @ rev 24974

Update some wget_url
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 02 11:23:24 2022 +0000 (2022-05-02)
parents
children
line source
1 A void error "cp: cannot create hard link 'file1' to 'file2': file exists"
3 --- a/cook
4 +++ b/cook
5 @@ -423,11 +423,9 @@
6 # A bit smarter function than the classic `cp` command
8 copy() {
9 - if [ "$(stat -c %h -- "$1")" -gt 1 ]; then
10 - cp -al "$1" "$2" # copy hardlinks
11 - else
12 - cp -a "$1" "$2" # copy generic files
13 - fi
14 + [ "$(stat -c %h -- "$1")" -gt 1 ] &&
15 + cp -al "$1" "$2" 2>/dev/null || # copy hardlinks
16 + cp -a "$1" "$2" # copy generic files
17 }