wok diff cookutils/stuff/avoid-hard-link-exist-error.patch @ rev 24867
updated lvm2, lvm2-dev, libdevmapper and libdevmapper-dev (2.03.08 -> 2.03.15)
author | Hans-G?nter Theisgen |
---|---|
date | Wed Mar 30 17:27:13 2022 +0100 (2022-03-30) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/cookutils/stuff/avoid-hard-link-exist-error.patch Wed Mar 30 17:27:13 2022 +0100 1.3 @@ -0,0 +1,19 @@ 1.4 +A void error "cp: cannot create hard link 'file1' to 'file2': file exists" 1.5 + 1.6 +--- a/cook 1.7 ++++ b/cook 1.8 +@@ -423,11 +423,9 @@ 1.9 + # A bit smarter function than the classic `cp` command 1.10 + 1.11 + copy() { 1.12 +- if [ "$(stat -c %h -- "$1")" -gt 1 ]; then 1.13 +- cp -al "$1" "$2" # copy hardlinks 1.14 +- else 1.15 +- cp -a "$1" "$2" # copy generic files 1.16 +- fi 1.17 ++ [ "$(stat -c %h -- "$1")" -gt 1 ] && 1.18 ++ cp -al "$1" "$2" 2>/dev/null || # copy hardlinks 1.19 ++ cp -a "$1" "$2" # copy generic files 1.20 + } 1.21 + 1.22 +