mirror of
https://github.com/markusressel/zfs-inplace-rebalancing
synced 2026-02-05 05:24:07 +00:00
Fix stat for BSD part 2
This commit is contained in:
parent
5c8aa9320d
commit
1f9ae6269f
16
testing.sh
16
testing.sh
@ -57,6 +57,20 @@ function get_time() {
|
||||
echo "$date"
|
||||
}
|
||||
|
||||
function get_inode() {
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
inode=$(stat -f "%i" "$1")
|
||||
;;
|
||||
*)
|
||||
inode=$(stat -c "%i" "$1")
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$inode"
|
||||
}
|
||||
|
||||
function assertions() {
|
||||
# check error log is empty
|
||||
if grep -q '[^[:space:]]' $log_error_file; then
|
||||
@ -67,7 +81,7 @@ function assertions() {
|
||||
}
|
||||
|
||||
function assert_matching_file_hardlinked() {
|
||||
if ! [ "$(stat -c "%i" "$1")" -eq "$(stat -c "%i" "$2")" ]; then
|
||||
if ! [ "$(get_inode "$1")" -eq "$(get_inode "$2")" ]; then
|
||||
echo "File '$1' was not hardlinked to '$2' when it should have been!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -282,7 +282,7 @@ if [[ "${OSName}" == "linux-gnu"* ]]; then
|
||||
find "$root_path" -type f -not -path '*/.zfs/*' -exec stat --printf '%d:%i|%n\n' {} \; > files_list.txt
|
||||
elif [[ "${OSName}" == "darwin"* ]] || [[ "${OSName}" == "freebsd"* ]]; then
|
||||
# Mac OS and FreeBSD
|
||||
find "$root_path" -type f -not -path '*/.zfs/*' -exec sh -c 'stat -f "%d:%i|%N" "$0"' {} \; > files_list.txt
|
||||
find "$root_path" -type f -not -path '*/.zfs/*' -exec stat -f "%d:%i|%N" {} \; > files_list.txt
|
||||
else
|
||||
echo "Unsupported OS type: $OSTYPE"
|
||||
exit 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user