Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 10 additions & 16 deletions RaspberryPi/raspi-f2fs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,21 @@ remove_ext4_configs() {
# Remove ext4-specific cron jobs
local cron_dir="$WD/t/r/etc/cron.d"
if [[ -d $cron_dir ]]; then
for f in "$cron_dir"/*; do
[[ -f $f ]] || continue
if grep -qi "e2fsck\|tune2fs\|ext4" "$f" 2>/dev/null; then
log "Removed ext4-specific cron job: ${f##*/}"
rm -f "$f"
fi
done
while IFS= read -r -d '' f; do
log "Removed ext4-specific cron job: ${f##*/}"
rm -f "$f"
done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$cron_dir"/* 2>/dev/null || true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better style guide adherence, it's recommended to use grep -E for extended regular expressions. The repository style guide specifies grep -E as the fallback for rg. This also allows for a cleaner regex pattern without escaping the pipe character.

Suggested change
done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$cron_dir"/* 2>/dev/null || true)
done < <(grep -liZE "e2fsck|tune2fs|ext4" "$cron_dir"/* 2>/dev/null || true)
References
  1. The repository style guide (line 141) specifies rg as the primary tool for grep operations, with grep -E as the fallback. Using grep -E for extended regular expressions is preferred over basic regular expressions with escaped characters. (link)

Comment on lines +111 to +114
fi

# Remove ext4-specific systemd timers
local systemd_dir="$WD/t/r/etc/systemd/system"
if [[ -d $systemd_dir ]]; then
for f in "$systemd_dir"/*.timer; do
[[ -f $f ]] || continue
if grep -qi "e2fsck\|tune2fs\|ext4" "$f" 2>/dev/null; then
log "Removed ext4-specific systemd timer: ${f##*/}"
rm -f "$f"
# Remove corresponding service file
rm -f "${f%.timer}.service" 2>/dev/null || :
fi
done
while IFS= read -r -d '' f; do
log "Removed ext4-specific systemd timer: ${f##*/}"
rm -f "$f"
# Remove corresponding service file
rm -f "${f%.timer}.service" 2>/dev/null || :
done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$systemd_dir"/*.timer 2>/dev/null || true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the previous comment, using grep -E here would align better with the repository's style guide for using extended regular expressions.

Suggested change
done < <(grep -liZ "e2fsck\|tune2fs\|ext4" "$systemd_dir"/*.timer 2>/dev/null || true)
done < <(grep -liZE "e2fsck|tune2fs|ext4" "$systemd_dir"/*.timer 2>/dev/null || true)
References
  1. The repository style guide (line 141) specifies rg as the primary tool for grep operations, with grep -E as the fallback. Using grep -E for extended regular expressions is preferred over basic regular expressions with escaped characters. (link)

Comment on lines +120 to +125
fi

log "ext4-specific configs removed"
Expand Down
Loading