Compare commits

...

55 Commits

Author SHA1 Message Date
ba86a1c23f Merge branch 'master' into unsupported/binary
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (alpine_3_21) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_23) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_13) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_43) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Check for merge conflicts / main (pull_request_target) Waiting to run
2026-03-18 14:03:11 +00:00
1703f169ba Merge pull request 'Move unattended check to the top of the script - exit early if /etc/pihole/pihole.toml file is not found,' (#1) from tweak/6380 into master
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Check for merge conflicts / main (push) Has been cancelled
Sync Back to Development / Syncing branches (push) Has been cancelled
Reviewed-on: #1
2026-03-18 14:02:47 +00:00
fbb3798dc2 Merge branch 'master' into tweak/6380
Some checks are pending
Check for merge conflicts / main (push) Waiting to run
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (alpine_3_21) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (alpine_3_23) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_13) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_43) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Check for merge conflicts / main (pull_request_target) Waiting to run
2026-03-18 14:02:37 +00:00
Adam Warner
a393dd83f3 v6.4 (#6536) 2026-02-17 20:26:56 +00:00
yubiuser
e929d799b8 Don't install unused /usr/local/share/man/man5 (#6526) 2026-02-14 20:36:17 +01:00
yubiuser
194d6e3565 Bump tox from 4.34.1 to 4.35.0 in /test in the python-dependencies group (#6533) 2026-02-14 13:13:51 +01:00
yubiuser
f90f456bcf Bump github/codeql-action from 4.32.2 to 4.32.3 in the github-actions-dependencies group (#6534) 2026-02-14 12:50:03 +01:00
dependabot[bot]
75af6dc968 Bump github/codeql-action in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.32.2 to 4.32.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](45cbd0c69e...9e907b5e64)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-14 10:02:35 +00:00
dependabot[bot]
0b0cbdf7d0 Bump tox from 4.34.1 to 4.35.0 in /test in the python-dependencies group
Bumps the python-dependencies group in /test with 1 update: [tox](https://github.com/tox-dev/tox).


Updates `tox` from 4.34.1 to 4.35.0
- [Release notes](https://github.com/tox-dev/tox/releases)
- [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/tox/compare/4.34.1...4.35.0)

---
updated-dependencies:
- dependency-name: tox
  dependency-version: 4.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-14 10:02:34 +00:00
yubiuser
6f54ce8c72 Bump github/codeql-action from 4.32.0 to 4.32.2 in the github-actions-dependencies group (#6528) 2026-02-07 11:12:58 +01:00
dependabot[bot]
a90df8072c Bump github/codeql-action in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.32.0 to 4.32.2
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](b20883b0cd...45cbd0c69e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-07 10:02:40 +00:00
darkexplosiveqwx
3d5c832dbe Remove /usr/local/share/man/man5 from tests
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-02-06 16:49:31 +01:00
darkexplosiveqwx
8c4778025a Don't install unused /usr/local/share/man/man5
Last used before `pihole-FTL.conf.5` was removed with https://github.com/pi-hole/pi-hole/pull/4489

Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2026-02-05 18:45:57 +01:00
yubiuser
8eb602bd2b Bump github/codeql-action from 4.31.11 to 4.32.0 in the github-actions-dependencies group (#6525) 2026-01-31 11:51:05 +01:00
dependabot[bot]
19f80a1aa7 Bump github/codeql-action in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.31.11 to 4.32.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](19b2f06db2...b20883b0cd)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-31 10:02:46 +00:00
yubiuser
8abfc5ae1a Bump the github-actions-dependencies group with 4 updates (#6522) 2026-01-28 09:02:56 +01:00
Christian König
03ee5b514d Fix black formatting
Signed-off-by: Christian König <github@yubiuser.dev>
2026-01-28 08:56:25 +01:00
dependabot[bot]
f0bc920384 Bump the github-actions-dependencies group with 4 updates
Bumps the github-actions-dependencies group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action), [psf/black](https://github.com/psf/black) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `actions/checkout` from 6.0.1 to 6.0.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e8c483db8...de0fac2e45)

Updates `github/codeql-action` from 4.31.10 to 4.31.11
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](cdefb33c0f...19b2f06db2)

Updates `psf/black` from 25.12.0 to 26.1.0
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](782e5605c8...6305bf1ae6)

Updates `actions/setup-python` from 6.1.0 to 6.2.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](83679a892e...a309ff8b42)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: psf/black
  dependency-version: 26.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions-dependencies
- dependency-name: actions/setup-python
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-24 10:02:49 +00:00
yubiuser
441832a331 Bump github/codeql-action from 4.31.9 to 4.31.10 in the github-actions-dependencies group (#6519) 2026-01-17 11:26:18 +01:00
dependabot[bot]
887255f518 Bump github/codeql-action in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.31.9 to 4.31.10
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](5d4e8d1aca...cdefb33c0f)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-17 10:02:42 +00:00
yubiuser
0f4594c88e Bump tox from 4.33.0 to 4.34.1 in /test in the python-dependencies group (#6515) 2026-01-10 11:05:42 +01:00
dependabot[bot]
ec6d3e2f83 Bump tox from 4.33.0 to 4.34.1 in /test in the python-dependencies group
Bumps the python-dependencies group in /test with 1 update: [tox](https://github.com/tox-dev/tox).


Updates `tox` from 4.33.0 to 4.34.1
- [Release notes](https://github.com/tox-dev/tox/releases)
- [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/tox/compare/4.33.0...4.34.1)

---
updated-dependencies:
- dependency-name: tox
  dependency-version: 4.34.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-10 10:01:07 +00:00
Adam Warner
f6531d722b Add missing -g to the message in gravity recovery command (#6513) 2026-01-08 17:46:38 +00:00
RD WebDesign
d0433cdb48 Add missing -g to the message in gravity recovery command
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2026-01-07 00:28:09 -03:00
Adam Warner
42ee5648cf Use configured location for web repo when updating or repairing (#6470) 2026-01-04 13:08:33 +00:00
yubiuser
d9e10413c3 Bump tox from 4.32.0 to 4.33.0 in /test in the python-dependencies group (#6510) 2026-01-03 13:22:09 +01:00
dependabot[bot]
102bc6043d Bump tox from 4.32.0 to 4.33.0 in /test in the python-dependencies group
Bumps the python-dependencies group in /test with 1 update: [tox](https://github.com/tox-dev/tox).


Updates `tox` from 4.32.0 to 4.33.0
- [Release notes](https://github.com/tox-dev/tox/releases)
- [Changelog](https://github.com/tox-dev/tox/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/tox/compare/4.32.0...4.33.0)

---
updated-dependencies:
- dependency-name: tox
  dependency-version: 4.33.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-03 10:01:40 +00:00
yubiuser
25a9897c4e Bump github/codeql-action from 4.31.8 to 4.31.9 in the github-actions-dependencies group (#6502) 2025-12-20 11:40:02 +01:00
dependabot[bot]
dd1e60b505 Bump github/codeql-action in the github-actions-dependencies group
Bumps the github-actions-dependencies group with 1 update: [github/codeql-action](https://github.com/github/codeql-action).


Updates `github/codeql-action` from 4.31.8 to 4.31.9
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](1b168cd394...5d4e8d1aca)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-20 10:01:25 +00:00
yubiuser
88a23f8f14 Bump pytest from 9.0.1 to 9.0.2 in /test in the python-dependencies group (#6500) 2025-12-13 16:49:39 +01:00
yubiuser
a1520d2fa6 Bump the github-actions-dependencies group with 3 updates (#6499) 2025-12-13 16:35:19 +01:00
dependabot[bot]
3ddf4014af Bump pytest in /test in the python-dependencies group
Bumps the python-dependencies group in /test with 1 update: [pytest](https://github.com/pytest-dev/pytest).


Updates `pytest` from 9.0.1 to 9.0.2
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.0.1...9.0.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-13 10:02:04 +00:00
dependabot[bot]
9f07e74eb8 Bump the github-actions-dependencies group with 3 updates
Bumps the github-actions-dependencies group with 3 updates: [github/codeql-action](https://github.com/github/codeql-action), [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) and [psf/black](https://github.com/psf/black).


Updates `github/codeql-action` from 4.31.7 to 4.31.8
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](cf1bb45a27...1b168cd394)

Updates `redhat-plumbers-in-action/differential-shellcheck` from 5.5.5 to 5.5.6
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](0d9e5b2962...d965e66ec0)

Updates `psf/black` from 25.11.0 to 25.12.0
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](05f0a8ce1f...782e5605c8)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-version: 5.5.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: psf/black
  dependency-version: 25.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-13 10:01:35 +00:00
yubiuser
beda7a5e0a Bump the github-actions-dependencies group with 3 updates (#6490) 2025-12-06 11:43:35 +01:00
dependabot[bot]
a5c6c2c12c Bump the github-actions-dependencies group with 3 updates
Bumps the github-actions-dependencies group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [github/codeql-action](https://github.com/github/codeql-action) and [actions/stale](https://github.com/actions/stale).


Updates `actions/checkout` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1af3b93b68...8e8c483db8)

Updates `github/codeql-action` from 4.31.5 to 4.31.7
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](fdbfb4d275...cf1bb45a27)

Updates `actions/stale` from 10.1.0 to 10.1.1
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](5f858e3efb...997185467f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: github/codeql-action
  dependency-version: 4.31.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: actions/stale
  dependency-version: 10.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-06 10:01:25 +00:00
Dan Schaper
7442623f2f Debug log - Add colors to gravity tables (#6485) 2025-12-04 12:52:07 -07:00
Dan Schaper
013abb2898 Add Alpine 3.23 to test suite (#6488) 2025-12-03 15:48:44 -07:00
Christian König
f5f74066fc Add Alpine 3.23 to test suite
Signed-off-by: Christian König <github@yubiuser.dev>
2025-12-03 23:37:04 +01:00
Dan Schaper
6ce1707b55 Remove custom FTL FirewallD zone checks from debug log (#6481) 2025-11-30 16:54:03 -07:00
Dan Schaper
e103fbe1c8 Bump the github-actions-dependencies group with 2 updates (#6483) 2025-11-30 16:53:25 -07:00
RD WebDesign
1f4ed9b518 Replace some strings with their colored equivalents
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-30 18:43:40 -03:00
RD WebDesign
95ae51bbdb Use more specific strings on the tables to match only desired text
- use `--no---` and `--yes---` to make sure the strings won't match user
comments or parts of domains
- also use `-ALLOW-` and `-BLOCK-`

Also reduce the domain column to 90 characters

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-30 18:42:02 -03:00
Dan Schaper
a1af212ec0 Remove wget from alpine dependencies (#6484) 2025-11-30 11:30:38 -07:00
darkexplosiveqwx
353105ec0f remove wget from alpine dependencies
Signed-off-by: darkexplosiveqwx <101737077+darkexplosiveqwx@users.noreply.github.com>
2025-11-30 19:00:34 +01:00
dependabot[bot]
d77179a412 Bump the github-actions-dependencies group with 2 updates
Bumps the github-actions-dependencies group with 2 updates: [github/codeql-action](https://github.com/github/codeql-action) and [actions/setup-python](https://github.com/actions/setup-python).


Updates `github/codeql-action` from 4.31.4 to 4.31.5
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](e12f017898...fdbfb4d275)

Updates `actions/setup-python` from 6.0.0 to 6.1.0
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](e797f83bcb...83679a892e)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: 4.31.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions-dependencies
- dependency-name: actions/setup-python
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-29 10:01:27 +00:00
Adam Warner
3a4c399982 Sync master back into development (#6482) 2025-11-27 23:21:18 +00:00
RD WebDesign
247b0c506b Remove custom FTL FirewallD zone checks from debug log
Removed checks for custom FTL FirewallD zone in piholeDebug.sh.

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
2025-11-26 23:46:43 -03:00
Rob Gill
03fd486921 use configured value for web repo when updating or repairing
Instead of hardcoded web repo location, get the currently configured location.
Imports utils.sh to facilitate this

Signed-off-by: Rob Gill <rrobgill@protonmail.com>
2025-11-11 07:28:21 +10:00
Adam Warner
5ed52554d7 Move unattended check to the top of the script - exit early if /etc/pihole/pihole.toml file is not found,
Some checks are pending
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2025-08-11 14:55:39 +01:00
Christian König
a9e3d3b728 Use --skipFTL flag also for pihole repair and checkout
Some checks are pending
CodeQL / Analyze (pull_request) Waiting to run
Test Supported Distributions / smoke-tests (pull_request) Waiting to run
Test Supported Distributions / distro-test (centos_10) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (centos_9) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_11) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (debian_12) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_40) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_41) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (fedora_42) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_20) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_22) (pull_request) Blocked by required conditions
Test Supported Distributions / distro-test (ubuntu_24) (pull_request) Blocked by required conditions
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-21 12:07:33 +02:00
Christian König
a8db4def9a Use flag --skipFTL instead of env var PIHOLE_SKIP_FTL_CHECK
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-21 11:54:12 +02:00
Christian König
463086ef23 Skip FTL update check if $PIHOLE_SKIP_FTL_CHECK is set to true
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-10 21:57:38 +02:00
Christian König
f3e04117f6 Let users know we skipped the FTL checks
Co-authored-by: davygravy <davygravy@users.noreply.github.com>
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-10 21:56:52 +02:00
Christian König
f67a8e5110 Only set PIHOLE_SKIP_FTL_CHECK if not already set by env variable
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-10 21:56:52 +02:00
Christian König
3f7f6f0294 Allow uses to skip binary check and installing FTL in case the use a self-compiled binary
Signed-off-by: Christian König <github@yubiuser.dev>
2025-07-10 21:56:52 +02:00
18 changed files with 268 additions and 278 deletions

View File

@@ -25,16 +25,16 @@ jobs:
steps: steps:
- -
name: Checkout repository name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- -
name: Initialize CodeQL name: Initialize CodeQL
uses: github/codeql-action/init@e12f0178983d466f2f6028f5cc7a6d786fd97f4b #v4.31.4 uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3
with: with:
languages: 'python' languages: 'python'
- -
name: Autobuild name: Autobuild
uses: github/codeql-action/autobuild@e12f0178983d466f2f6028f5cc7a6d786fd97f4b #v4.31.4 uses: github/codeql-action/autobuild@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3
- -
name: Perform CodeQL Analysis name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e12f0178983d466f2f6028f5cc7a6d786fd97f4b #v4.31.4 uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 #v4.32.3

View File

@@ -17,7 +17,7 @@ jobs:
issues: write issues: write
steps: steps:
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 #v10.1.0 - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d #v10.1.1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30 days-before-stale: 30
@@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: Remove 'stale' label - name: Remove 'stale' label
run: gh issue edit ${{ github.event.issue.number }} --remove-label ${{ env.stale_label }} run: gh issue edit ${{ github.event.issue.number }} --remove-label ${{ env.stale_label }}
env: env:

View File

@@ -17,7 +17,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 #v10.1.0 - uses: actions/stale@997185467fa4f803885201cee163a9f38240193d #v10.1.1
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
# Do not automatically mark PR/issue as stale # Do not automatically mark PR/issue as stale

View File

@@ -33,7 +33,7 @@ jobs:
name: Syncing branches name: Syncing branches
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: Opening pull request - name: Opening pull request
run: gh pr create -B development -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'internal' run: gh pr create -B development -H master --title 'Sync master back into development' --body 'Created by Github action' --label 'internal'
env: env:

View File

@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with: with:
fetch-depth: 0 # Differential ShellCheck requires full git history fetch-depth: 0 # Differential ShellCheck requires full git history
@@ -31,7 +31,7 @@ jobs:
[[ $FAIL == 1 ]] && exit 1 || echo "Scripts are executable!" [[ $FAIL == 1 ]] && exit 1 || echo "Scripts are executable!"
- name: Differential ShellCheck - name: Differential ShellCheck
uses: redhat-plumbers-in-action/differential-shellcheck@0d9e5b29625f871e6a4215380486d6f1a7cb6cdd #v5.5.5 uses: redhat-plumbers-in-action/differential-shellcheck@d965e66ec0b3b2f821f75c8eff9b12442d9a7d1e #v5.5.6
with: with:
severity: warning severity: warning
display-engine: sarif-fmt display-engine: sarif-fmt
@@ -49,7 +49,7 @@ jobs:
run: editorconfig-checker run: editorconfig-checker
- name: Check python code formatting with black - name: Check python code formatting with black
uses: psf/black@05f0a8ce1f71fbb36e1e032d3b518c7b945089a2 #25.11.0 uses: psf/black@6305bf1ae645ab7541be4f5028a86239316178eb #26.1.0
with: with:
src: "./test" src: "./test"
options: "--check --diff --color" options: "--check --diff --color"
@@ -77,15 +77,16 @@ jobs:
fedora_43, fedora_43,
alpine_3_21, alpine_3_21,
alpine_3_22, alpine_3_22,
alpine_3_23,
] ]
env: env:
DISTRO: ${{matrix.distro}} DISTRO: ${{matrix.distro}}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: Set up Python - name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 #v6.2.0
with: with:
python-version: "3.13" python-version: "3.13"

View File

@@ -41,6 +41,22 @@ warning1() {
} }
checkout() { checkout() {
local skipFTL additionalFlag
skipFTL=false
# Check arguments
for var in "$@"; do
case "$var" in
"--skipFTL") skipFTL=true ;;
esac
done
if [ "${skipFTL}" == true ]; then
additionalFlag="--skipFTL"
else
additionalFlag=""
fi
local corebranches local corebranches
local webbranches local webbranches
@@ -235,7 +251,7 @@ checkout() {
# Force updating everything # Force updating everything
if [[ ! "${1}" == "web" && ! "${1}" == "ftl" ]]; then if [[ ! "${1}" == "web" && ! "${1}" == "ftl" ]]; then
echo -e " ${INFO} Running installer to upgrade your installation" echo -e " ${INFO} Running installer to upgrade your installation"
if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended; then if "${PI_HOLE_FILES_DIR}/automated install/basic-install.sh" --unattended ${additionalFlag}; then
exit 0 exit 0
else else
echo -e " ${COL_RED} Error: Unable to complete update, please contact support${COL_NC}" echo -e " ${COL_RED} Error: Unable to complete update, please contact support${COL_NC}"

View File

@@ -375,22 +375,6 @@ check_firewalld() {
log_write "${CROSS} ${COL_RED} Allow Service: ${i}${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})" log_write "${CROSS} ${COL_RED} Allow Service: ${i}${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
fi fi
done done
# check for custom FTL FirewallD zone
local firewalld_zones
firewalld_zones=$(firewall-cmd --get-zones)
if [[ "${firewalld_zones}" =~ "ftl" ]]; then
log_write "${TICK} ${COL_GREEN}FTL Custom Zone Detected${COL_NC}";
# check FTL custom zone interface: lo
local firewalld_ftl_zone_interfaces
firewalld_ftl_zone_interfaces=$(firewall-cmd --zone=ftl --list-interfaces)
if [[ "${firewalld_ftl_zone_interfaces}" =~ "lo" ]]; then
log_write "${TICK} ${COL_GREEN} Local Interface Detected${COL_NC}";
else
log_write "${CROSS} ${COL_RED} Local Interface Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
fi
else
log_write "${CROSS} ${COL_RED}FTL Custom Zone Not Detected${COL_NC} (${FAQ_HARDWARE_REQUIREMENTS_FIREWALLD})"
fi
fi fi
else else
log_write "${TICK} ${COL_GREEN}Firewalld service not detected${COL_NC}"; log_write "${TICK} ${COL_GREEN}Firewalld service not detected${COL_NC}";
@@ -1022,6 +1006,24 @@ show_db_entries() {
) )
for line in "${entries[@]}"; do for line in "${entries[@]}"; do
# Use gray color for "no". Normal color for "yes"
line=${line//--no---/${COL_GRAY} no ${COL_NC}}
line=${line//--yes--/ yes }
# Use red for "deny" and green for "allow"
if [ "$title" = "Domainlist" ]; then
line=${line//regex-deny/${COL_RED}regex-deny${COL_NC}}
line=${line//regex-allow/${COL_GREEN}regex-allow${COL_NC}}
line=${line//exact-deny/${COL_RED}exact-deny${COL_NC}}
line=${line//exact-allow/${COL_GREEN}exact-allow${COL_NC}}
fi
# Use red for "block" and green for "allow"
if [ "$title" = "Adlists" ]; then
line=${line//-BLOCK-/${COL_RED} Block ${COL_NC}}
line=${line//-ALLOW-/${COL_GREEN} Allow ${COL_NC}}
fi
log_write " ${line}" log_write " ${line}"
done done
@@ -1069,15 +1071,15 @@ check_dhcp_servers() {
} }
show_groups() { show_groups() {
show_db_entries "Groups" "SELECT id,CASE enabled WHEN '0' THEN ' no' WHEN '1' THEN ' yes' ELSE enabled END enabled,name,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,description FROM \"group\"" "4 7 50 19 19 50" show_db_entries "Groups" "SELECT id,CASE enabled WHEN '0' THEN '--no---' WHEN '1' THEN '--yes--' ELSE enabled END enabled,name,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,description FROM \"group\"" "4 7 50 19 19 50"
} }
show_adlists() { show_adlists() {
show_db_entries "Adlists" "SELECT id,CASE enabled WHEN '0' THEN ' no' WHEN '1' THEN ' yes' ELSE enabled END enabled,GROUP_CONCAT(adlist_by_group.group_id) group_ids, CASE type WHEN '0' THEN 'Block' WHEN '1' THEN 'Allow' ELSE type END type, address,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,comment FROM adlist LEFT JOIN adlist_by_group ON adlist.id = adlist_by_group.adlist_id GROUP BY id;" "5 7 12 5 100 19 19 50" show_db_entries "Adlists" "SELECT id,CASE enabled WHEN '0' THEN '--no---' WHEN '1' THEN '--yes--' ELSE enabled END enabled,GROUP_CONCAT(adlist_by_group.group_id) group_ids, CASE type WHEN '0' THEN '-BLOCK-' WHEN '1' THEN '-ALLOW-' ELSE type END type, address,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,comment FROM adlist LEFT JOIN adlist_by_group ON adlist.id = adlist_by_group.adlist_id GROUP BY id;" "5 7 12 7 100 19 19 50"
} }
show_domainlist() { show_domainlist() {
show_db_entries "Domainlist" "SELECT id,CASE type WHEN '0' THEN 'exact-allow' WHEN '1' THEN 'exact-deny' WHEN '2' THEN 'regex-allow' WHEN '3' THEN 'regex-deny' ELSE type END type,CASE enabled WHEN '0' THEN ' no' WHEN '1' THEN ' yes' ELSE enabled END enabled,GROUP_CONCAT(domainlist_by_group.group_id) group_ids,domain,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,comment FROM domainlist LEFT JOIN domainlist_by_group ON domainlist.id = domainlist_by_group.domainlist_id GROUP BY id;" "5 11 7 12 100 19 19 50" show_db_entries "Domainlist" "SELECT id,CASE type WHEN '0' THEN 'exact-allow' WHEN '1' THEN 'exact-deny' WHEN '2' THEN 'regex-allow' WHEN '3' THEN 'regex-deny' ELSE type END type,CASE enabled WHEN '0' THEN '--no---' WHEN '1' THEN '--yes--' ELSE enabled END enabled,GROUP_CONCAT(domainlist_by_group.group_id) group_ids,domain,datetime(date_added,'unixepoch','localtime') date_added,datetime(date_modified,'unixepoch','localtime') date_modified,comment FROM domainlist LEFT JOIN domainlist_by_group ON domainlist.id = domainlist_by_group.domainlist_id GROUP BY id;" "5 11 7 12 90 19 19 50"
} }
show_clients() { show_clients() {

View File

@@ -149,31 +149,37 @@ main() {
echo -e " ${INFO} Web Interface:\\t${COL_GREEN}up to date${COL_NC}" echo -e " ${INFO} Web Interface:\\t${COL_GREEN}up to date${COL_NC}"
fi fi
local funcOutput # Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
funcOutput=$(get_binary_name) #Store output of get_binary_name here if [ "${skipFTL}" != true ]; then
local binary local funcOutput
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL) funcOutput=$(get_binary_name) #Store output of get_binary_name here
local binary
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
if FTLcheckUpdate "${binary}" &>/dev/null; then if FTLcheckUpdate "${binary}" &>/dev/null; then
FTL_update=true FTL_update=true
echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}" echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}update available${COL_NC}"
else
case $? in
1)
echo -e " ${INFO} FTL:\\t\\t${COL_GREEN}up to date${COL_NC}"
;;
2)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
exit 1
;;
3)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, cannot reach download server${COL_NC}"
exit 1
;;
*)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, contact support${COL_NC}"
exit 1
esac
FTL_update=false
fi
else else
case $? in echo -e " ${INFO} FTL:\\t\\t${COL_YELLOW}--skipFTL set - update check skipped${COL_NC}"
1)
echo -e " ${INFO} FTL:\\t\\t${COL_GREEN}up to date${COL_NC}"
;;
2)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Branch is not available.${COL_NC}\\n\\t\\t\\tUse ${COL_GREEN}pihole checkout ftl [branchname]${COL_NC} to switch to a valid branch."
exit 1
;;
3)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, cannot reach download server${COL_NC}"
exit 1
;;
*)
echo -e " ${INFO} FTL:\\t\\t${COL_RED}Something has gone wrong, contact support${COL_NC}"
exit 1
esac
FTL_update=false FTL_update=false
fi fi
@@ -222,7 +228,14 @@ main() {
fi fi
if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then if [[ "${FTL_update}" == true || "${core_update}" == true ]]; then
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended || \ local addionalFlag
if [[ ${skipFTL} == true ]]; then
addionalFlag="--skipFTL"
else
addionalFlag=""
fi
${PI_HOLE_FILES_DIR}/automated\ install/basic-install.sh --repair --unattended ${addionalFlag} || \
echo -e "${basicError}" && exit 1 echo -e "${basicError}" && exit 1
fi fi
@@ -242,8 +255,15 @@ main() {
exit 0 exit 0
} }
if [[ "$1" == "--check-only" ]]; then CHECK_ONLY=false
CHECK_ONLY=true skipFTL=false
fi
# Check arguments
for var in "$@"; do
case "$var" in
"--check-only") CHECK_ONLY=true ;;
"--skipFTL") skipFTL=true ;;
esac
done
main main

View File

@@ -155,7 +155,7 @@ EOM
) )
# List of required packages on APK based systems # List of required packages on APK based systems
PIHOLE_META_VERSION_APK=0.1 PIHOLE_META_VERSION_APK=0.2
PIHOLE_META_DEPS_APK=( PIHOLE_META_DEPS_APK=(
bash bash
bash-completion bash-completion
@@ -181,7 +181,6 @@ PIHOLE_META_DEPS_APK=(
sudo sudo
tzdata tzdata
unzip unzip
wget
) )
######## Undocumented Flags. Shhh ######## ######## Undocumented Flags. Shhh ########
@@ -189,14 +188,27 @@ PIHOLE_META_DEPS_APK=(
# The runUnattended flag is one example of this # The runUnattended flag is one example of this
repair=false repair=false
runUnattended=false runUnattended=false
skipFTL=false
# Check arguments for the undocumented flags # Check arguments for the undocumented flags
for var in "$@"; do for var in "$@"; do
case "${var}" in case "${var}" in
"--repair") repair=true ;; "--repair") repair=true ;;
"--unattended") runUnattended=true ;; "--unattended") runUnattended=true ;;
"--skipFTL") skipFTL=true ;;
esac esac
done done
if [[ "${runUnattended}" == true ]]; then
# In order to run an unattended setup, a pre-seeded /etc/pihole/pihole.toml must exist
if [[ ! -f "${PI_HOLE_CONFIG_DIR}/pihole.toml" ]]; then
printf " %b Error: \"%s\" not found. Cannot run unattended setup\\n" "${CROSS}" "${PI_HOLE_CONFIG_DIR}/pihole.toml"
exit 1
fi
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
# also disable debconf-apt-progress dialogs
export DEBIAN_FRONTEND="noninteractive"
fi
# If the color table file exists, # If the color table file exists,
if [[ -f "${coltable}" ]]; then if [[ -f "${coltable}" ]]; then
# source it # source it
@@ -1252,10 +1264,6 @@ install_manpage() {
# if not present, create man8 directory # if not present, create man8 directory
install -d -m 755 /usr/local/share/man/man8 install -d -m 755 /usr/local/share/man/man8
fi fi
if [[ ! -d "/usr/local/share/man/man5" ]]; then
# if not present, create man5 directory
install -d -m 755 /usr/local/share/man/man5
fi
# Testing complete, copy the files & update the man db # Testing complete, copy the files & update the man db
install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/manpages/pihole.8 /usr/local/share/man/man8/pihole.8 install -D -m 644 -T ${PI_HOLE_LOCAL_REPO}/manpages/pihole.8 /usr/local/share/man/man8/pihole.8
@@ -1808,6 +1816,12 @@ clone_or_reset_repos() {
# If the user wants to repair/update, # If the user wants to repair/update,
if [[ "${repair}" == true ]]; then if [[ "${repair}" == true ]]; then
printf " %b Resetting local repos\\n" "${INFO}" printf " %b Resetting local repos\\n" "${INFO}"
# import getFTLConfigValue from utils.sh
source "/opt/pihole/utils.sh"
# Use the configured Web repo location on repair/update
webInterfaceDir=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
# Reset the Core repo # Reset the Core repo
resetRepo ${PI_HOLE_LOCAL_REPO} || resetRepo ${PI_HOLE_LOCAL_REPO} ||
{ {
@@ -2321,21 +2335,18 @@ main() {
# Check if there is a usable FTL binary available on this architecture - do # Check if there is a usable FTL binary available on this architecture - do
# this early on as FTL is a hard dependency for Pi-hole # this early on as FTL is a hard dependency for Pi-hole
local funcOutput # Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
funcOutput=$(get_binary_name) #Store output of get_binary_name here if [ "${skipFTL}" != true ]; then
# Abort early if this processor is not supported (get_binary_name returns empty string) # Get the binary name for the current architecture
if [[ "${funcOutput}" == "" ]]; then local funcOutput
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}" funcOutput=$(get_binary_name) #Store output of get_binary_name here
exit 1 # Abort early if this processor is not supported (get_binary_name returns empty string)
fi if [[ "${funcOutput}" == "" ]]; then
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
if [[ "${fresh_install}" == false ]]; then exit 1
# if it's running unattended,
if [[ "${runUnattended}" == true ]]; then
printf " %b Performing unattended setup, no dialogs will be displayed\\n" "${INFO}"
# also disable debconf-apt-progress dialogs
export DEBIAN_FRONTEND="noninteractive"
fi fi
else
printf " %b %b--skipFTL set - skipping architecture check%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
fi fi
if [[ "${fresh_install}" == true ]]; then if [[ "${fresh_install}" == true ]]; then
@@ -2368,13 +2379,18 @@ main() {
create_pihole_user create_pihole_user
# Download and install FTL # Download and install FTL
local binary # Allow the user to skip this check if they are using a self-compiled FTL binary from an unsupported architecture
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL) if [ "${skipFTL}" != true ]; then
local theRest local binary
theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL") binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
if ! FTLdetect "${binary}" "${theRest}"; then local theRest
printf " %b FTL Engine not installed\\n" "${CROSS}" theRest="${funcOutput%pihole-FTL*}" # Print the rest of get_binary_name's output to display (cut out from first instance of "pihole-FTL")
exit 1 if ! FTLdetect "${binary}" "${theRest}"; then
printf " %b FTL Engine not installed\\n" "${CROSS}"
exit 1
fi
else
printf " %b %b--skipFTL set - skipping FTL binary installation%b\\n" "${INFO}" "${COL_YELLOW}" "${COL_NC}"
fi fi
# Install and log everything to a file # Install and log everything to a file

View File

@@ -947,7 +947,7 @@ database_recovery() {
else else
echo -e "${OVER} ${CROSS} ${str} - the following errors happened:" echo -e "${OVER} ${CROSS} ${str} - the following errors happened:"
while IFS= read -r line; do echo " - $line"; done <<<"$result" while IFS= read -r line; do echo " - $line"; done <<<"$result"
echo -e " ${CROSS} Recovery failed. Try \"pihole -r recreate\" instead." echo -e " ${CROSS} Recovery failed. Try \"pihole -g -r recreate\" instead."
exit 1 exit 1
fi fi
echo "" echo ""

19
pihole
View File

@@ -125,7 +125,22 @@ repairPiholeFunc() {
if [ -n "${DOCKER_VERSION}" ]; then if [ -n "${DOCKER_VERSION}" ]; then
unsupportedFunc unsupportedFunc
else else
/etc/.pihole/automated\ install/basic-install.sh --repair local skipFTL additionalFlag
skipFTL=false
# Check arguments
for var in "$@"; do
case "$var" in
"--skipFTL") skipFTL=true ;;
esac
done
if [ "${skipFTL}" == true ]; then
additionalFlag="--skipFTL"
else
additionalFlag=""
fi
/etc/.pihole/automated\ install/basic-install.sh --repair ${additionalFlag}
exit 0; exit 0;
fi fi
} }
@@ -601,7 +616,7 @@ case "${1}" in
"-d" | "debug" ) debugFunc "$@";; "-d" | "debug" ) debugFunc "$@";;
"-f" | "flush" ) flushFunc "$@";; "-f" | "flush" ) flushFunc "$@";;
"-up" | "updatePihole" ) updatePiholeFunc "$@";; "-up" | "updatePihole" ) updatePiholeFunc "$@";;
"-r" | "repair" ) repairPiholeFunc;; "-r" | "repair" ) repairPiholeFunc "$@";;
"-g" | "updateGravity" ) updateGravityFunc "$@";; "-g" | "updateGravity" ) updateGravityFunc "$@";;
"-l" | "logging" ) piholeLogging "$@";; "-l" | "logging" ) piholeLogging "$@";;
"uninstall" ) uninstallFunc;; "uninstall" ) uninstallFunc;;

View File

@@ -0,0 +1,18 @@
FROM alpine:3.23
ENV GITDIR=/etc/.pihole
ENV SCRIPTDIR=/opt/pihole
RUN sed -i 's/#\(.*\/community\)/\1/' /etc/apk/repositories
RUN apk --no-cache add bash coreutils curl git jq openrc shadow
RUN mkdir -p $GITDIR $SCRIPTDIR /etc/pihole
ADD . $GITDIR
RUN cp $GITDIR/advanced/Scripts/*.sh $GITDIR/gravity.sh $GITDIR/pihole $GITDIR/automated\ install/*.sh $GITDIR/advanced/Scripts/COL_TABLE $SCRIPTDIR/
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$SCRIPTDIR
RUN true && \
chmod +x $SCRIPTDIR/*
ENV SKIP_INSTALL=true
#sed '/# Start the installer/Q' /opt/pihole/basic-install.sh > /opt/pihole/stub_basic-install.sh && \

View File

@@ -51,29 +51,19 @@ def mock_command(script, args, container):
in unit tests in unit tests
""" """
full_script_path = "/usr/local/bin/{}".format(script) full_script_path = "/usr/local/bin/{}".format(script)
mock_script = dedent( mock_script = dedent(r"""\
r"""\
#!/bin/bash -e #!/bin/bash -e
echo "\$0 \$@" >> /var/log/{script} echo "\$0 \$@" >> /var/log/{script}
case "\$1" in""".format( case "\$1" in""".format(script=script))
script=script
)
)
for k, v in args.items(): for k, v in args.items():
case = dedent( case = dedent("""
"""
{arg}) {arg})
echo {res} echo {res}
exit {retcode} exit {retcode}
;;""".format( ;;""".format(arg=k, res=v[0], retcode=v[1]))
arg=k, res=v[0], retcode=v[1]
)
)
mock_script += case mock_script += case
mock_script += dedent( mock_script += dedent("""
""" esac""")
esac"""
)
container.run( container.run(
""" """
cat <<EOF> {script}\n{content}\nEOF cat <<EOF> {script}\n{content}\nEOF
@@ -94,37 +84,23 @@ def mock_command_passthrough(script, args, container):
""" """
orig_script_path = container.check_output("command -v {}".format(script)) orig_script_path = container.check_output("command -v {}".format(script))
full_script_path = "/usr/local/bin/{}".format(script) full_script_path = "/usr/local/bin/{}".format(script)
mock_script = dedent( mock_script = dedent(r"""\
r"""\
#!/bin/bash -e #!/bin/bash -e
echo "\$0 \$@" >> /var/log/{script} echo "\$0 \$@" >> /var/log/{script}
case "\$1" in""".format( case "\$1" in""".format(script=script))
script=script
)
)
for k, v in args.items(): for k, v in args.items():
case = dedent( case = dedent("""
"""
{arg}) {arg})
echo {res} echo {res}
exit {retcode} exit {retcode}
;;""".format( ;;""".format(arg=k, res=v[0], retcode=v[1]))
arg=k, res=v[0], retcode=v[1]
)
)
mock_script += case mock_script += case
mock_script += dedent( mock_script += dedent(r"""
r"""
*) *)
{orig_script_path} "\$@" {orig_script_path} "\$@"
;;""".format( ;;""".format(orig_script_path=orig_script_path))
orig_script_path=orig_script_path mock_script += dedent("""
) esac""")
)
mock_script += dedent(
"""
esac"""
)
container.run( container.run(
""" """
cat <<EOF> {script}\n{content}\nEOF cat <<EOF> {script}\n{content}\nEOF
@@ -141,29 +117,19 @@ def mock_command_run(script, args, container):
in unit tests in unit tests
""" """
full_script_path = "/usr/local/bin/{}".format(script) full_script_path = "/usr/local/bin/{}".format(script)
mock_script = dedent( mock_script = dedent(r"""\
r"""\
#!/bin/bash -e #!/bin/bash -e
echo "\$0 \$@" >> /var/log/{script} echo "\$0 \$@" >> /var/log/{script}
case "\$1 \$2" in""".format( case "\$1 \$2" in""".format(script=script))
script=script
)
)
for k, v in args.items(): for k, v in args.items():
case = dedent( case = dedent("""
"""
\"{arg}\") \"{arg}\")
echo {res} echo {res}
exit {retcode} exit {retcode}
;;""".format( ;;""".format(arg=k, res=v[0], retcode=v[1]))
arg=k, res=v[0], retcode=v[1]
)
)
mock_script += case mock_script += case
mock_script += dedent( mock_script += dedent(r"""
""" esac""")
esac"""
)
container.run( container.run(
""" """
cat <<EOF> {script}\n{content}\nEOF cat <<EOF> {script}\n{content}\nEOF
@@ -180,29 +146,19 @@ def mock_command_2(script, args, container):
in unit tests in unit tests
""" """
full_script_path = "/usr/local/bin/{}".format(script) full_script_path = "/usr/local/bin/{}".format(script)
mock_script = dedent( mock_script = dedent(r"""\
r"""\
#!/bin/bash -e #!/bin/bash -e
echo "\$0 \$@" >> /var/log/{script} echo "\$0 \$@" >> /var/log/{script}
case "\$1 \$2" in""".format( case "\$1 \$2" in""".format(script=script))
script=script
)
)
for k, v in args.items(): for k, v in args.items():
case = dedent( case = dedent("""
"""
\"{arg}\") \"{arg}\")
echo \"{res}\" echo \"{res}\"
exit {retcode} exit {retcode}
;;""".format( ;;""".format(arg=k, res=v[0], retcode=v[1]))
arg=k, res=v[0], retcode=v[1]
)
)
mock_script += case mock_script += case
mock_script += dedent( mock_script += dedent(r"""
""" esac""")
esac"""
)
container.run( container.run(
""" """
cat <<EOF> {script}\n{content}\nEOF cat <<EOF> {script}\n{content}\nEOF

View File

@@ -1,6 +1,6 @@
pyyaml == 6.0.3 pyyaml == 6.0.3
pytest == 9.0.1 pytest == 9.0.2
pytest-xdist == 3.8.0 pytest-xdist == 3.8.0
pytest-testinfra == 10.2.2 pytest-testinfra == 10.2.2
tox == 4.32.0 tox == 4.35.0
pytest-clarity == 1.0.1 pytest-clarity == 1.0.1

View File

@@ -6,10 +6,8 @@ from .conftest import (
info_box, info_box,
cross_box, cross_box,
mock_command, mock_command,
mock_command_run,
mock_command_2, mock_command_2,
mock_command_passthrough, mock_command_passthrough,
run_script,
) )
FTL_BRANCH = "development" FTL_BRANCH = "development"
@@ -23,12 +21,10 @@ def test_supported_package_manager(host):
host.run("rm -rf /usr/bin/apt-get") host.run("rm -rf /usr/bin/apt-get")
host.run("rm -rf /usr/bin/rpm") host.run("rm -rf /usr/bin/rpm")
host.run("rm -rf /sbin/apk") host.run("rm -rf /sbin/apk")
package_manager_detect = host.run( package_manager_detect = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
package_manager_detect package_manager_detect
""" """)
)
expected_stdout = cross_box + " No supported package manager found" expected_stdout = cross_box + " No supported package manager found"
assert expected_stdout in package_manager_detect.stdout assert expected_stdout in package_manager_detect.stdout
# assert package_manager_detect.rc == 1 # assert package_manager_detect.rc == 1
@@ -38,13 +34,11 @@ def test_selinux_not_detected(host):
""" """
confirms installer continues when SELinux configuration file does not exist confirms installer continues when SELinux configuration file does not exist
""" """
check_selinux = host.run( check_selinux = host.run("""
"""
rm -f /etc/selinux/config rm -f /etc/selinux/config
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
""" """)
)
expected_stdout = info_box + " SELinux not detected" expected_stdout = info_box + " SELinux not detected"
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
assert check_selinux.rc == 0 assert check_selinux.rc == 0
@@ -95,8 +89,7 @@ def test_installPihole_fresh_install_readableFiles(host):
host.run("command -v apk > /dev/null && apk add mandoc man-pages") host.run("command -v apk > /dev/null && apk add mandoc man-pages")
# Workaround to get FTLv6 installed until it reaches master branch # Workaround to get FTLv6 installed until it reaches master branch
host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch') host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch')
install = host.run( install = host.run("""
"""
export TERM=xterm export TERM=xterm
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
umask 0027 umask 0027
@@ -105,8 +98,7 @@ def test_installPihole_fresh_install_readableFiles(host):
runUnattended=true runUnattended=true
main main
/opt/pihole/pihole-FTL-prestart.sh /opt/pihole/pihole-FTL-prestart.sh
""" """)
)
assert 0 == install.rc assert 0 == install.rc
maninstalled = True maninstalled = True
if (info_box + " man not installed") in install.stdout: if (info_box + " man not installed") in install.stdout:
@@ -162,12 +154,6 @@ def test_installPihole_fresh_install_readableFiles(host):
check_man = test_cmd.format("r", "/usr/local/share/man/man8", piholeuser) check_man = test_cmd.format("r", "/usr/local/share/man/man8", piholeuser)
actual_rc = host.run(check_man).rc actual_rc = host.run(check_man).rc
assert exit_status_success == actual_rc assert exit_status_success == actual_rc
check_man = test_cmd.format("x", "/usr/local/share/man/man5", piholeuser)
actual_rc = host.run(check_man).rc
assert exit_status_success == actual_rc
check_man = test_cmd.format("r", "/usr/local/share/man/man5", piholeuser)
actual_rc = host.run(check_man).rc
assert exit_status_success == actual_rc
check_man = test_cmd.format( check_man = test_cmd.format(
"r", "/usr/local/share/man/man8/pihole.8", piholeuser "r", "/usr/local/share/man/man8/pihole.8", piholeuser
) )
@@ -201,13 +187,11 @@ def test_update_package_cache_success_no_errors(host):
""" """
confirms package cache was updated without any errors confirms package cache was updated without any errors
""" """
updateCache = host.run( updateCache = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
package_manager_detect package_manager_detect
update_package_cache update_package_cache
""" """)
)
expected_stdout = tick_box + " Update local cache of available packages" expected_stdout = tick_box + " Update local cache of available packages"
assert expected_stdout in updateCache.stdout assert expected_stdout in updateCache.stdout
assert "error" not in updateCache.stdout.lower() assert "error" not in updateCache.stdout.lower()
@@ -218,13 +202,11 @@ def test_update_package_cache_failure_no_errors(host):
confirms package cache was not updated confirms package cache was not updated
""" """
mock_command("apt-get", {"update": ("", "1")}, host) mock_command("apt-get", {"update": ("", "1")}, host)
updateCache = host.run( updateCache = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
package_manager_detect package_manager_detect
update_package_cache update_package_cache
""" """)
)
expected_stdout = cross_box + " Update local cache of available packages" expected_stdout = cross_box + " Update local cache of available packages"
assert expected_stdout in updateCache.stdout assert expected_stdout in updateCache.stdout
assert "Error: Unable to update package cache." in updateCache.stdout assert "Error: Unable to update package cache." in updateCache.stdout
@@ -260,16 +242,14 @@ def test_FTL_detect_no_errors(host, arch, detected_string, supported):
host, host,
) )
host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch') host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch')
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
create_pihole_user create_pihole_user
funcOutput=$(get_binary_name) funcOutput=$(get_binary_name)
binary="pihole-FTL${funcOutput##*pihole-FTL}" binary="pihole-FTL${funcOutput##*pihole-FTL}"
theRest="${funcOutput%pihole-FTL*}" theRest="${funcOutput%pihole-FTL*}"
FTLdetect "${binary}" "${theRest}" FTLdetect "${binary}" "${theRest}"
""" """)
)
if supported: if supported:
expected_stdout = info_box + " FTL Checks..." expected_stdout = info_box + " FTL Checks..."
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -289,22 +269,18 @@ def test_FTL_development_binary_installed_and_responsive_no_errors(host):
confirms FTL development binary is copied and functional in installed location confirms FTL development binary is copied and functional in installed location
""" """
host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch') host.run('echo "' + FTL_BRANCH + '" > /etc/pihole/ftlbranch')
host.run( host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
create_pihole_user create_pihole_user
funcOutput=$(get_binary_name) funcOutput=$(get_binary_name)
binary="pihole-FTL${funcOutput##*pihole-FTL}" binary="pihole-FTL${funcOutput##*pihole-FTL}"
theRest="${funcOutput%pihole-FTL*}" theRest="${funcOutput%pihole-FTL*}"
FTLdetect "${binary}" "${theRest}" FTLdetect "${binary}" "${theRest}"
""" """)
) version_check = host.run("""
version_check = host.run(
"""
VERSION=$(pihole-FTL version) VERSION=$(pihole-FTL version)
echo ${VERSION:0:1} echo ${VERSION:0:1}
""" """)
)
expected_stdout = "v" expected_stdout = "v"
assert expected_stdout in version_check.stdout assert expected_stdout in version_check.stdout
@@ -319,12 +295,10 @@ def test_IPv6_only_link_local(host):
{"-6 address": ("inet6 fe80::d210:52fa:fe00:7ad7/64 scope link", "0")}, {"-6 address": ("inet6 fe80::d210:52fa:fe00:7ad7/64 scope link", "0")},
host, host,
) )
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
find_IPv6_information find_IPv6_information
""" """)
)
expected_stdout = "Unable to find IPv6 ULA/GUA address" expected_stdout = "Unable to find IPv6 ULA/GUA address"
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -344,12 +318,10 @@ def test_IPv6_only_ULA(host):
}, },
host, host,
) )
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
find_IPv6_information find_IPv6_information
""" """)
)
expected_stdout = "Found IPv6 ULA address" expected_stdout = "Found IPv6 ULA address"
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -369,12 +341,10 @@ def test_IPv6_only_GUA(host):
}, },
host, host,
) )
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
find_IPv6_information find_IPv6_information
""" """)
)
expected_stdout = "Found IPv6 GUA address" expected_stdout = "Found IPv6 GUA address"
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -395,12 +365,10 @@ def test_IPv6_GUA_ULA_test(host):
}, },
host, host,
) )
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
find_IPv6_information find_IPv6_information
""" """)
)
expected_stdout = "Found IPv6 ULA address" expected_stdout = "Found IPv6 ULA address"
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -421,12 +389,10 @@ def test_IPv6_ULA_GUA_test(host):
}, },
host, host,
) )
detectPlatform = host.run( detectPlatform = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
find_IPv6_information find_IPv6_information
""" """)
)
expected_stdout = "Found IPv6 ULA address" expected_stdout = "Found IPv6 ULA address"
assert expected_stdout in detectPlatform.stdout assert expected_stdout in detectPlatform.stdout
@@ -437,14 +403,10 @@ def test_validate_ip(host):
""" """
def test_address(addr, success=True): def test_address(addr, success=True):
output = host.run( output = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
valid_ip "{addr}" valid_ip "{addr}"
""".format( """.format(addr=addr))
addr=addr
)
)
assert output.rc == 0 if success else 1 assert output.rc == 0 if success else 1
@@ -479,15 +441,13 @@ def test_validate_ip(host):
def test_package_manager_has_pihole_deps(host): def test_package_manager_has_pihole_deps(host):
"""Confirms OS is able to install the required packages for Pi-hole""" """Confirms OS is able to install the required packages for Pi-hole"""
mock_command("dialog", {"*": ("", "0")}, host) mock_command("dialog", {"*": ("", "0")}, host)
output = host.run( output = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
package_manager_detect package_manager_detect
update_package_cache update_package_cache
build_dependency_package build_dependency_package
install_dependent_packages install_dependent_packages
""" """)
)
assert "No package" not in output.stdout assert "No package" not in output.stdout
assert output.rc == 0 assert output.rc == 0
@@ -496,21 +456,17 @@ def test_package_manager_has_pihole_deps(host):
def test_meta_package_uninstall(host): def test_meta_package_uninstall(host):
"""Confirms OS is able to install and uninstall the Pi-hole meta package""" """Confirms OS is able to install and uninstall the Pi-hole meta package"""
mock_command("dialog", {"*": ("", "0")}, host) mock_command("dialog", {"*": ("", "0")}, host)
install = host.run( install = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
package_manager_detect package_manager_detect
update_package_cache update_package_cache
build_dependency_package build_dependency_package
install_dependent_packages install_dependent_packages
""" """)
)
assert install.rc == 0 assert install.rc == 0
uninstall = host.run( uninstall = host.run("""
"""
source /opt/pihole/uninstall.sh source /opt/pihole/uninstall.sh
removeMetaPackage removeMetaPackage
""" """)
)
assert uninstall.rc == 0 assert uninstall.rc == 0

View File

@@ -1,31 +1,25 @@
def test_key_val_replacement_works(host): def test_key_val_replacement_works(host):
"""Confirms addOrEditKeyValPair either adds or replaces a key value pair in a given file""" """Confirms addOrEditKeyValPair either adds or replaces a key value pair in a given file"""
host.run( host.run("""
"""
source /opt/pihole/utils.sh source /opt/pihole/utils.sh
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value1" addOrEditKeyValPair "./testoutput" "KEY_ONE" "value1"
addOrEditKeyValPair "./testoutput" "KEY_TWO" "value2" addOrEditKeyValPair "./testoutput" "KEY_TWO" "value2"
addOrEditKeyValPair "./testoutput" "KEY_ONE" "value3" addOrEditKeyValPair "./testoutput" "KEY_ONE" "value3"
addOrEditKeyValPair "./testoutput" "KEY_FOUR" "value4" addOrEditKeyValPair "./testoutput" "KEY_FOUR" "value4"
""" """)
) output = host.run("""
output = host.run(
"""
cat ./testoutput cat ./testoutput
""" """)
)
expected_stdout = "KEY_ONE=value3\nKEY_TWO=value2\nKEY_FOUR=value4\n" expected_stdout = "KEY_ONE=value3\nKEY_TWO=value2\nKEY_FOUR=value4\n"
assert expected_stdout == output.stdout assert expected_stdout == output.stdout
def test_getFTLPID_default(host): def test_getFTLPID_default(host):
"""Confirms getFTLPID returns the default value if FTL is not running""" """Confirms getFTLPID returns the default value if FTL is not running"""
output = host.run( output = host.run("""
"""
source /opt/pihole/utils.sh source /opt/pihole/utils.sh
getFTLPID getFTLPID
""" """)
)
expected_stdout = "-1\n" expected_stdout = "-1\n"
assert expected_stdout == output.stdout assert expected_stdout == output.stdout
@@ -36,8 +30,7 @@ def test_setFTLConfigValue_getFTLConfigValue(host):
Requires FTL to be installed, so we do that first Requires FTL to be installed, so we do that first
(taken from test_FTL_development_binary_installed_and_responsive_no_errors) (taken from test_FTL_development_binary_installed_and_responsive_no_errors)
""" """
host.run( host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
create_pihole_user create_pihole_user
funcOutput=$(get_binary_name) funcOutput=$(get_binary_name)
@@ -45,15 +38,12 @@ def test_setFTLConfigValue_getFTLConfigValue(host):
binary="pihole-FTL${funcOutput##*pihole-FTL}" binary="pihole-FTL${funcOutput##*pihole-FTL}"
theRest="${funcOutput%pihole-FTL*}" theRest="${funcOutput%pihole-FTL*}"
FTLdetect "${binary}" "${theRest}" FTLdetect "${binary}" "${theRest}"
""" """)
)
output = host.run( output = host.run("""
"""
source /opt/pihole/utils.sh source /opt/pihole/utils.sh
setFTLConfigValue "dns.upstreams" '["9.9.9.9"]' > /dev/null setFTLConfigValue "dns.upstreams" '["9.9.9.9"]' > /dev/null
getFTLConfigValue "dns.upstreams" getFTLConfigValue "dns.upstreams"
""" """)
)
assert "[ 9.9.9.9 ]" in output.stdout assert "[ 9.9.9.9 ]" in output.stdout

View File

@@ -15,14 +15,10 @@ def mock_selinux_config(state, host):
# getenforce returns the running state of SELinux # getenforce returns the running state of SELinux
mock_command("getenforce", {"*": (state.capitalize(), "0")}, host) mock_command("getenforce", {"*": (state.capitalize(), "0")}, host)
# create mock configuration with desired content # create mock configuration with desired content
host.run( host.run("""
"""
mkdir /etc/selinux mkdir /etc/selinux
echo "SELINUX={state}" > /etc/selinux/config echo "SELINUX={state}" > /etc/selinux/config
""".format( """.format(state=state.lower()))
state=state.lower()
)
)
def test_selinux_enforcing_exit(host): def test_selinux_enforcing_exit(host):
@@ -30,12 +26,10 @@ def test_selinux_enforcing_exit(host):
confirms installer prompts to exit when SELinux is Enforcing by default confirms installer prompts to exit when SELinux is Enforcing by default
""" """
mock_selinux_config("enforcing", host) mock_selinux_config("enforcing", host)
check_selinux = host.run( check_selinux = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
""" """)
)
expected_stdout = cross_box + " Current SELinux: enforcing" expected_stdout = cross_box + " Current SELinux: enforcing"
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
expected_stdout = "SELinux Enforcing detected, exiting installer" expected_stdout = "SELinux Enforcing detected, exiting installer"
@@ -48,12 +42,10 @@ def test_selinux_permissive(host):
confirms installer continues when SELinux is Permissive confirms installer continues when SELinux is Permissive
""" """
mock_selinux_config("permissive", host) mock_selinux_config("permissive", host)
check_selinux = host.run( check_selinux = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
""" """)
)
expected_stdout = tick_box + " Current SELinux: permissive" expected_stdout = tick_box + " Current SELinux: permissive"
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
assert check_selinux.rc == 0 assert check_selinux.rc == 0
@@ -64,12 +56,10 @@ def test_selinux_disabled(host):
confirms installer continues when SELinux is Disabled confirms installer continues when SELinux is Disabled
""" """
mock_selinux_config("disabled", host) mock_selinux_config("disabled", host)
check_selinux = host.run( check_selinux = host.run("""
"""
source /opt/pihole/basic-install.sh source /opt/pihole/basic-install.sh
checkSelinux checkSelinux
""" """)
)
expected_stdout = tick_box + " Current SELinux: disabled" expected_stdout = tick_box + " Current SELinux: disabled"
assert expected_stdout in check_selinux.stdout assert expected_stdout in check_selinux.stdout
assert check_selinux.rc == 0 assert check_selinux.rc == 0

10
test/tox.alpine_3_23.ini Normal file
View File

@@ -0,0 +1,10 @@
[tox]
envlist = py3
[testenv:py3]
allowlist_externals = docker
deps = -rrequirements.txt
setenv =
COLUMNS=120
commands = docker buildx build --load --progress plain -f _alpine_3_23.Dockerfile -t pytest_pihole:test_container ../
pytest {posargs:-vv -n auto} ./test_any_automated_install.py ./test_any_utils.py