Skip to content
Closed
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
13 changes: 9 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ warn() { echo -e "${YELLOW}[⚠]${NC} $*"; }
error() { echo -e "${RED}[✗]${NC} $*"; }
step() { echo -e "\n${YELLOW}[STEP]${NC} $*"; }

# 🛡 Error handler
# 🛡 Error handler
trap 'error "Installation failed. See logs above."; exit 1' ERR

# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -65,7 +65,7 @@ handle_systemd_resolved() {
# shellcheck disable=SC1091
. /etc/os-release
if [[ "${ID:-}" == ubuntu* || "${ID_LIKE:-}" == *ubuntu* ]]; then
if systemctl list-unit-files | grep -q '^systemd-resolved\\.service'; then
if systemctl list-unit-files | grep -q '^systemd-resolved\.service'; then
if systemctl is-active --quiet systemd-resolved; then
warn "systemd-resolved is active; stopping to free port 53"
systemctl stop systemd-resolved || true
Expand Down Expand Up @@ -129,7 +129,7 @@ configure_unbound() {
install -d -m 0755 /var/lib/unbound
curl -fsSL https://www.internic.net/domain/named.root -o /var/lib/unbound/root.hints

cat > /etc/unbound/unbound.conf.d/pi-hole.conf <<'UNBOUND_EOF'
cat > /etc/unbound/unbound.conf.d/pi-hole.conf <<EOF
server:
interface: 127.0.0.1
port: $UNBOUND_PORT
Expand All @@ -154,7 +154,7 @@ forward-zone:
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
# NOTE: This is DoT forwarding to Quad9 (not full recursion to the root); intended.
UNBOUND_EOF
EOF
Comment on lines 154 to +157
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): Das Umschalten von einem zitierten Heredoc zu einem nicht zitierten kann zu Variablenerweiterung führen.

Das vorherige zitierte Heredoc verhinderte die Variablenerweiterung; die neue nicht zitierte Version wird Variablen wie $UNBOUND_PORT erweitern. Bestätige, dass diese Änderung beabsichtigt ist und alle Variablen gesetzt sind, oder kehre zum zitierten Heredoc zurück, um unbeabsichtigte Substitutionen zu vermeiden.

Suggested change
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
# NOTE: This is DoT forwarding to Quad9 (not full recursion to the root); intended.
UNBOUND_EOF
EOF
cat > /etc/unbound/unbound.conf.d/pi-hole.conf <<'UNBOUND_EOF'
server:
interface: 127.0.0.1
port: $UNBOUND_PORT
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
# NOTE: This is DoT forwarding to Quad9 (not full recursion to the root); intended.
UNBOUND_EOF
Original comment in English

suggestion (bug_risk): Switching from a quoted heredoc to an unquoted one may cause variable expansion.

The previous quoted heredoc prevented variable expansion; the new unquoted version will expand variables like $UNBOUND_PORT. Confirm this change is intentional and all variables are set, or revert to the quoted heredoc to avoid unintended substitutions.

Suggested change
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
# NOTE: This is DoT forwarding to Quad9 (not full recursion to the root); intended.
UNBOUND_EOF
EOF
cat > /etc/unbound/unbound.conf.d/pi-hole.conf <<'UNBOUND_EOF'
server:
interface: 127.0.0.1
port: $UNBOUND_PORT
forward-addr: 9.9.9.9@853#dns.quad9.net
forward-addr: 149.112.112.112@853#dns.quad9.net
# NOTE: This is DoT forwarding to Quad9 (not full recursion to the root); intended.
UNBOUND_EOF


unbound-anchor -a /var/lib/unbound/root.key || true
systemctl enable --now unbound
Expand Down Expand Up @@ -290,3 +290,8 @@ main() {
show_summary
}
main "$@"
SCRIPT
Copy link

Choose a reason for hiding this comment

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

issue: Die Ergänzung von '+SCRIPT' scheint eine überflüssige Zeile zu sein.

Bitte entferne diese Zeile, um Verwirrung oder unbeabsichtigtes Verhalten zu vermeiden.

Original comment in English

issue: The addition of '+SCRIPT' appears to be a stray line.

Please remove this line to prevent confusion or unintended behavior.


# Syntax prüfen & ausführen
sudo bash -n install.sh && echo "Syntax OK"
sudo ./install.sh
Comment on lines +296 to +297
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Das Ausführen von 'sudo bash -n install.sh' und anschließend 'sudo ./install.sh' kann dazu führen, dass sich das Skript rekursiv selbst ausführt.

Wenn das Ziel darin besteht, ein anderes Skript zu validieren und auszuführen, gib bitte den korrekten Dateinamen an, um Rekursion oder unbeabsichtigtes Verhalten zu vermeiden.

Original comment in English

issue (bug_risk): Running 'sudo bash -n install.sh' and then 'sudo ./install.sh' may cause the script to execute itself recursively.

If the goal is to validate and run a different script, please specify the correct file name to avoid recursion or unintended behavior.