Skip to content

Conversation

@TimInTech
Copy link
Owner

No description provided.

Copilot AI review requested due to automatic review settings November 12, 2025 10:55
Copy link

Copilot AI left a 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/auth and X-FTL-SID header
  • Added healthcheck tool to the installer with robust fallback mechanisms
  • Updated backup operations to use v6 file structure (pihole.toml instead of setupVars.conf, hosts/*.list instead of custom.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.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link

Copilot AI left a 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
Copy link

Copilot AI Nov 12, 2025

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

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Nov 12, 2025

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

Copilot uses AI. Check for mistakes.
if (( PURGE )) && [[ -d /var/backups/pihole ]]; then
rm -rf /var/backups/pihole/
echo "✔ Removed backups: /var/backups/pihole/ (purge)"
else
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
else
elif [[ -d /var/backups/pihole ]]; then

Copilot uses AI. Check for mistakes.
--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)
Copy link

Copilot AI Nov 12, 2025

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/

Suggested change
--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/

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
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" \
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
"${extra_headers[@]}" -H "Accept: application/json" \
"${extra_headers[@]+"${extra_headers[@]}"}" -H "Accept: application/json" \

Copilot uses AI. Check for mistakes.
echo "✔ Removed: /usr/local/bin/pihole_maintenance_pro.sh"
fi

# 2. Remove logs and temporary files
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
# 2. Remove logs and temporary files

Copilot uses AI. Check for mistakes.
…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
@TimInTech TimInTech merged commit 6eee154 into main Nov 12, 2025
4 checks passed
@TimInTech TimInTech deleted the fix/online-minimal-cleanup branch November 12, 2025 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant