-
Notifications
You must be signed in to change notification settings - Fork 0
chore(repo): cleanup + v6-docs + healthcheck installer + SC2034 suppress #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the repository to align with Pi-hole v6 changes, adding session-based authentication support, improving the installer, and cleaning up documentation. The changes migrate away from deprecated v6 features (like cli_pw and reloaddns) while adding new functionality like a healthcheck tool installer.
Key changes:
- Migrated API authentication from Basic Auth to session-based auth with
POST /api/authandX-FTL-SIDheader - Added healthcheck tool to the installer with robust fallback mechanisms
- Updated backup operations to use v6 file structure (
pihole.tomlinstead ofsetupVars.conf,hosts/*.listinstead ofcustom.list)
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/pihole_api_healthcheck.sh | Replaced Basic Auth with session-based authentication for v6 API |
| scripts/install.sh | Added root check, healthcheck tool installer, and idempotent cron setup |
| scripts/uninstall.sh | Added root check and --purge flag for conditional backup removal |
| pihole_maintenance_pro.sh | Added --restart-ftl flag, deprecated --no-dnsreload, updated backup paths for v6 |
| docs/Anleitung_DE.md | Reformatted and updated documentation for v6 API changes |
| README.md | Updated documentation with v6 session auth details and formatting improvements |
| README.de.md | German version of README updates |
| LICENSE | Updated copyright holder name |
| .gitignore | Added common development artifacts to ignore list |
| .env.example | New file documenting environment variables for healthcheck |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cp -a /etc/pihole/pihole-FTL.db "$BACKUP_DIR" 2> /dev/null || true | ||
| cp -a /etc/pihole/custom.list "$BACKUP_DIR" 2> /dev/null || true | ||
| cp -a /etc/pihole/pihole.toml "$BACKUP_DIR" 2> /dev/null || true | ||
| cp -a /etc/pihole/hosts/*.list "$BACKUP_DIR" 2> /dev/null || true |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glob pattern may fail if no matching files exist. The pattern /etc/pihole/hosts/*.list will fail if the hosts directory doesn't exist or contains no .list files, causing cp to attempt copying the literal string instead. Consider adding a check or using a more robust pattern: [[ -d /etc/pihole/hosts ]] && find /etc/pihole/hosts -name '*.list' -exec cp -a {} "$BACKUP_DIR" \; 2>/dev/null || true
| cp -a /etc/pihole/*.db "$backup_dir" 2> /dev/null || true | ||
| cp -a /etc/pihole/*.conf "$backup_dir" 2> /dev/null || true | ||
| cp -a /etc/pihole/pihole.toml "$backup_dir" 2> /dev/null || true | ||
| cp -a /etc/pihole/hosts/*.list "$backup_dir" 2> /dev/null || true |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glob pattern may fail if no matching files exist. The pattern /etc/pihole/hosts/*.list will fail if the hosts directory doesn't exist or contains no .list files, causing cp to attempt copying the literal string instead. Consider adding a check or using a more robust pattern: [[ -d /etc/pihole/hosts ]] && find /etc/pihole/hosts -name '*.list' -exec cp -a {} "$backup_dir" \; 2>/dev/null || true
| if (( PURGE )) && [[ -d /var/backups/pihole ]]; then | ||
| rm -rf /var/backups/pihole/ | ||
| echo "✔ Removed backups: /var/backups/pihole/ (purge)" | ||
| else |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading message when backups don't exist. The else branch at line 40-41 prints "Backups preserved (use --purge to remove)" even when /var/backups/pihole doesn't exist or when PURGE is 0 but the directory doesn't exist. Consider: elif [[ -d /var/backups/pihole ]]; then echo "ℹ Backups preserved..."; fi to only show the message when backups actually exist.
| else | |
| elif [[ -d /var/backups/pihole ]]; then |
| --no-upgrade Skip "pihole -up" | ||
| --no-gravity Skip "pihole -g" | ||
| --no-dnsreload Skip "pihole reloaddns" | ||
| --restart-ftl Restart pihole-FTL at the end (v6: only if needed) |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete help text: the --backup flag is implemented and parsed (lines 84-87) but not documented in the help text. Add a line to the help output describing this flag, e.g., --backup Create backup before Pi-hole ops under /var/backups/pihole/
| --restart-ftl Restart pihole-FTL at the end (v6: only if needed) | |
| --restart-ftl Restart pihole-FTL at the end (v6: only if needed) | |
| --backup Create backup before Pi-hole ops under /var/backups/pihole/ |
| HC_URL="$RAW_BASE/tools/pihole_api_healthcheck.sh" | ||
| HC_TMP="$TMP/pihole_api_healthcheck.sh" | ||
| HC_OUT="/usr/local/bin/pihole_api_healthcheck.sh" | ||
| if curl -fsSL "$HC_URL" -o "$HC_TMP" || curl -fsSL "$HC_URL" -o "$HC_TMP"; then |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant duplicate curl attempt detected. Line 21 executes the same curl command twice with ||, which means if the first attempt fails, it immediately retries the exact same command. This is likely unintentional and doesn't add meaningful retry logic. Consider either removing the duplicate or implementing proper retry logic with a delay if needed.
| if curl -fsSL "$HC_URL" -o "$HC_TMP" || curl -fsSL "$HC_URL" -o "$HC_TMP"; then | |
| # Retry curl up to 3 times with 2s delay between attempts | |
| ATTEMPTS=3 | |
| for i in $(seq 1 $ATTEMPTS); do | |
| if curl -fsSL "$HC_URL" -o "$HC_TMP"; then | |
| break | |
| elif [[ $i -lt $ATTEMPTS ]]; then | |
| sleep 2 | |
| fi | |
| done | |
| if [[ -f "$HC_TMP" ]]; then |
| local extra_headers=() | ||
| [[ -n "$SID" ]] && extra_headers+=(-H "X-FTL-SID: $SID") | ||
| if ! curl -sS --connect-timeout 3 --max-time 7 \ | ||
| "${extra_headers[@]}" -H "Accept: application/json" \ |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential issue with empty array expansion when set -u is enabled. When SID is empty, extra_headers remains an empty array, and "${extra_headers[@]}" will cause an "unbound variable" error in bash with set -u. Use "${extra_headers[@]+"${extra_headers[@]}"}" or disable set -u temporarily, or add a conditional to only include the array expansion when it's not empty.
| "${extra_headers[@]}" -H "Accept: application/json" \ | |
| "${extra_headers[@]+"${extra_headers[@]}"}" -H "Accept: application/json" \ |
| echo "✔ Removed: /usr/local/bin/pihole_maintenance_pro.sh" | ||
| fi | ||
|
|
||
| # 2. Remove logs and temporary files |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete cleanup: the installer now installs the healthcheck script to /usr/local/bin/pihole_api_healthcheck.sh (line 22 in install.sh), but the uninstaller doesn't remove it. This leaves orphaned files after uninstall. Add: rm -f /usr/local/bin/pihole_api_healthcheck.sh in the uninstall script.
| # 2. Remove logs and temporary files |
…oad; allow RUN_SELFTEST without root; fix awk quoting in healthcheck; align with CI selftest (cherry picked from commit ea379eb)
…ller; uninstall removes healthcheck; dotenv example and ignores
No description provided.