Fix disableCoW race

This commit is contained in:
2023-03-21 11:25:14 -04:00
parent 439fbc8ca0
commit cc31f9b62e

View File

@@ -1553,10 +1553,8 @@ disableCoW() {
declare mc_system_path="/usr/lib/jriver" declare mc_system_path="/usr/lib/jriver"
declare mc_user_path="$HOME/.jriver" declare mc_user_path="$HOME/.jriver"
[[ -d "$mc_user_path" ]] || mkdir -p "$mc_user_path"
for dir in "$mc_system_path" "$mc_user_path"; do for dir in "$mc_system_path" "$mc_user_path"; do
[[ -d "$dir" ]] || return [[ -d "$dir" ]] || execute mkdir -p "$dir"
if [[ $(stat -f -c %T "$dir") == "btrfs" ]] && if [[ $(stat -f -c %T "$dir") == "btrfs" ]] &&
! lsattr -d "$dir" | cut -f1 -d" " | grep -q C; then ! lsattr -d "$dir" | cut -f1 -d" " | grep -q C; then
echo "Disabling Btrfs CoW for $dir" echo "Disabling Btrfs CoW for $dir"