diff --git a/h2mm b/h2mm index 4721021..2d2678f 100755 --- a/h2mm +++ b/h2mm @@ -21,7 +21,7 @@ VERSION_URL="https://raw.githubusercontent.com/v4n00/h2mm-cli/refs/heads/master/ breaking_changes_patches=( ["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$1/mods.csv"' ["3"]='sed -i "1 i\\3" "$1/mods.csv"' - ["4"]='awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" | tee "$1/mods.csv" > /dev/null' + ["4"]='tmp_file=$(mktemp) && awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" > "$tmp_file" && tee "$1/mods.csv" < "$tmp_file" > /dev/null && rm "$tmp_file"' ) # --- Utility Functions --- diff --git a/install.sh b/install.sh index 92a1b7b..928f2d0 100755 --- a/install.sh +++ b/install.sh @@ -44,7 +44,7 @@ EOF breaking_changes_patches=( ["2"]='sed -i "s/^\([0-9]\+\),/\1,ENABLED,/" "$1/mods.csv"' ["3"]='sed -i "1 i\\3" "$1/mods.csv"' - ["4"]='awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" | tee "$1/mods.csv" > /dev/null' + ["4"]='tmp_file=$(mktemp) && awk '\''BEGIN {FS=OFS=","} NR==1 {print 4; next} {print NR-1, $2, $3, $4, $5}'\'' "$1/mods.csv" > "$tmp_file" && tee "$1/mods.csv" < "$tmp_file" > /dev/null && rm "$tmp_file"' ) # notify if update is happening