# There are no tagged releases of Pi-hole 6 yet, so here we are using # git snapshots of the version 6 beta %global core_commit 112b961762d1902da79b16b23a9bfc6e2e79f40a %global core_shortcommit %(c=%{core_commit}; echo ${c:0:8}) %global core_gittag vDev %global core_ver %{core_gittag}-g%{core_shortcommit} %global core_dir pi-hole-%{core_commit} %global ftl_commit 988a3c3d827468ed3f47e46adfb64b3970b51483 %global ftl_shortcommit %(c=%{ftl_commit}; echo ${c:0:8}) %global ftl_gittag vDev %global ftl_ver %{ftl_gittag}-g%{ftl_shortcommit} %global ftl_dir FTL-%{ftl_commit} %global web_commit c689fdc72c3bdf7107d5d7d2b1c9003321c2d368 %global web_shortcommit %(c=%{web_commit}; echo ${c:0:8}) %global web_gittag vDev %global web_ver %{web_gittag}-g%{web_shortcommit} %global web_dir web-%{web_commit} Name: pihole Version: 6.0 Release: 0.11.beta%{?dist} Summary: Pi-hole network-wide ad blocking service License: EUPL-1.2 and BSD-2-Clause and MIT URL: https://pi-hole.net/ # User/Group allocation config Source0: pihole.sysusers Source1: https://github.com/pi-hole/pi-hole/archive/%{core_commit}/%{name}-%{core_shortcommit}.tar.gz Source2: https://github.com/pi-hole/FTL/archive/%{ftl_commit}/%{name}-ftl-%{ftl_shortcommit}.tar.gz Source3: https://github.com/pi-hole/web/archive/%{web_commit}/%{name}-web-%{web_shortcommit}.tar.gz # MAC address/vendor data Source4: https://ftl.pi-hole.net/macvendor.db # Pi-hole default configuration Source5: pihole.toml Patch0: 0001-Disable-uninstall-update-functions.patch Patch1: 0002-Remove-compat-logging-links.patch Patch2: 0003-Prevent-dnsmasq-config-function-from-being-optimised.patch Patch3: 0004-Fix-compilation-errors-caused-by-GCC-14.patch BuildRequires: gcc BuildRequires: cmake BuildRequires: xxd BuildRequires: pkgconfig(gmp) BuildRequires: pkgconfig(hogweed) BuildRequires: pkgconfig(libidn2) BuildRequires: pkgconfig(nettle) BuildRequires: pkgconfig(readline) %if 0%{?fedora} >= 41 # Base Fedora has mbedtls >= 3.5 since Fedora 41 BuildRequires: mbedtls3.6-devel %else # Dep from COPR repo for Fedora 40 and older BuildRequires: mbedtls3-devel %endif BuildRequires: libunistring-devel BuildRequires: systemd-rpm-macros %{?sysusers_requires_compat} %description The Pi-hole is a DNS sinkhole that protects your devices from unwanted content, without installing any client-side software. %prep %setup -T -c %{name}-%{version} -a1 -a2 -a3 %autopatch -p1 pushd %{core_dir} rm advanced/Scripts/update.sh # We'll install app specific scripts somewhere better than /opt in order # to comply with packaging guidelines # - https://docs.fedoraproject.org/en-US/packaging-guidelines/#_limited_usage_of_opt_etcopt_and_varopt # - https://docs.fedoraproject.org/en-US/packaging-guidelines/#_libexecdir sed -i -e 's|/opt/pihole|%{_libexecdir}/%{name}|' \ pihole gravity.sh advanced/Scripts/*.sh \ advanced/Templates/pihole-FTL.systemd \ advanced/Templates/%{name}-FTL-prestart.sh \ advanced/Templates/%{name}-FTL-poststop.sh # Web root must not be under /var/www in order to comply with packaging # guidelines # - https://docs.fedoraproject.org/en-US/packaging-guidelines/#_web_applications sed -i -e 's|/var/www/html|%{_datadir}/%{name}|' \ advanced/Scripts/*.sh \ ../%{ftl_dir}/src/config/config.c # All binaries must go in /usr/bin # - https://docs.fedoraproject.org/en-US/packaging-guidelines/#_no_files_or_directories_under_srv_usrlocal_or_homeuser sed -i -e 's|/usr/local/bin|%{_bindir}|' \ pihole gravity.sh advanced/Scripts/*.sh # Fix location of database scripts sed -i -e 's|advanced/Scripts/||' -e 's|advanced/Templates/|database_migration/|' \ -e 's|/etc/\.pihole|%{_libexecdir}/%{name}|' gravity.sh advanced/Scripts/database_migration/gravity-db.sh # Extract DNS server details from the upstream install script source <(sed -n '/^DNS_SERVERS=/,/^EOM$/p' automated\ install/basic-install.sh ; echo ')') echo "${DNS_SERVERS}" >> advanced/Templates/dns-servers.conf # Create default block list files echo -n "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" > adlists.list # Set log rotate user sed -i -e 's/# su #/su pihole pihole/g' advanced/Templates/logrotate # Create versions file cat <> versions CORE_VERSION=%{core_ver} CORE_BRANCH=development-v6 CORE_HASH=%{core_shortcommit} GITHUB_CORE_VERSION=null GITHUB_CORE_HASH=%{core_shortcommit} WEB_VERSION=%{web_ver} WEB_BRANCH=development-v6 WEB_HASH=%{web_shortcommit} GITHUB_WEB_VERSION=null GITHUB_WEB_HASH=%{web_shortcommit} FTL_VERSION=%{ftl_ver} FTL_BRANCH=development-v6 FTL_HASH=%{ftl_shortcommit} GITHUB_FTL_VERSION=null GITHUB_FTL_HASH=%{ftl_shortcommit} END popd # Collate licenses mv ./%{core_dir}/LICENSE LICENSE-core mv ./%{ftl_dir}/LICENSE LICENSE-ftl mv ./%{ftl_dir}/src/tre-regex/LICENSE LICENSE-tre mv ./%{ftl_dir}/src/config/tomlc99/LICENSE LICENSE-toml mv ./%{web_dir}/LICENSE LICENSE-web mv ./%{web_dir}/vendor/LICENSE LICENSE-web-scripts %build # git branch | sed -n 's/^\* //p' export GIT_BRANCH=development # git --no-pager describe --always --abbrev=8 --dirty export GIT_HASH=%{ftl_shortcommit} # git describe --tags --abbrev=0 export GIT_TAG=%{ftl_gittag} # git --no-pager describe --tags --always --abbrev=8 --dirty export GIT_VERSION=%{ftl_ver} # git --no-pager show --date=short --format="%ai" --name-only | head -n 1 export GIT_DATE="2024-11-14 18:44:44 +0100" pushd %{ftl_dir} %cmake %cmake_build popd %install # User/Group configuration install -Dpm 0644 %{SOURCE0} %{buildroot}%{_sysusersdir}/%{name}.conf pushd %{core_dir} mkdir -p %{buildroot}%{_localstatedir}/{lib,log}/%{name} # The main pihole script and accompanying man page install -Dpm 0755 -t %{buildroot}%{_bindir} pihole install -Dpm 0644 -t %{buildroot}%{_mandir}/man8 manpages/%{name}.8 # Support scripts for pihole install -Dpm 0755 -t %{buildroot}%{_libexecdir}/%{name} \ gravity.sh advanced/Scripts/COL_TABLE advanced/Scripts/*.sh install -Dpm 0644 -t %{buildroot}%{_sysconfdir}/bash_completion.d \ advanced/bash-completion/%{name} # Support scripts for gravity install -Dpm 0755 -t %{buildroot}%{_libexecdir}/%{name}/database_migration \ advanced/Scripts/database_migration/gravity-db.sh install -Dpm 0644 -t %{buildroot}%{_libexecdir}/%{name}/database_migration \ advanced/Templates/*.sql install -Dpm 0644 -t %{buildroot}%{_libexecdir}/%{name}/database_migration/gravity \ advanced/Scripts/database_migration/gravity/*.sql # Service files for pihole-FTL install -Dpm 0644 advanced/Templates/%{name}-FTL.systemd \ %{buildroot}%{_unitdir}/%{name}-FTL.service install -Dpm 0755 -t %{buildroot}%{_libexecdir}/%{name} \ advanced/Templates/%{name}-FTL-prestart.sh \ advanced/Templates/%{name}-FTL-poststop.sh # Configuration files mkdir -p %{buildroot}%{_sysconfdir}/%{name}/hosts install -Dpm 0644 -t %{buildroot}%{_sysconfdir}/%{name} versions \ advanced/Templates/dns-servers.conf %{SOURCE4} %{SOURCE5} # Logging install -Dpm 0644 advanced/Templates/logrotate \ %{buildroot}%{_sysconfdir}/logrotate.d/%{name} popd # The pihole-FTL binary pushd %{ftl_dir} %cmake_install popd # Web interface install -m 0755 -d %{buildroot}%{_datadir}/%{name}/admin cp -pr %{web_dir}/* %{buildroot}%{_datadir}/%{name}/admin %check pushd %{ftl_dir} %ctest popd %pre %sysusers_create_compat %{SOURCE0} %post %systemd_post %{name}-FTL.service # Run gravity to aggregate all of the domains into a single HOSTS formatted list # and upgrade the database if [ "$1" = "1" ] ; then # Initialise with default adlists on first install, this file will be deleted # by the gravity script echo -n "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" > \ %{_sysconfdir}/%{name}/adlists.list chown pihole:pihole %{_sysconfdir}/%{name}/adlists.list fi %{_libexecdir}/%{name}/gravity.sh --force %preun %systemd_preun %{name}-FTL.service %postun %systemd_postun_with_restart %{name}-FTL.service %files %license LICENSE-* %dir %attr(755,pihole,pihole) %{_sysconfdir}/%{name} %dir %attr(755,pihole,pihole) %{_sysconfdir}/%{name}/hosts %dir %attr(755,pihole,pihole) %{_localstatedir}/lib/%{name} %dir %attr(750,pihole,pihole) %{_localstatedir}/log/%{name} %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %config(noreplace) %attr(-,pihole,pihole) %{_sysconfdir}/%{name}/dns-servers.conf %config(noreplace) %attr(-,pihole,pihole) %{_sysconfdir}/%{name}/pihole.toml %config %{_sysconfdir}/%{name}/macvendor.db %config %{_sysconfdir}/%{name}/versions %{_bindir}/%{name} %{_bindir}/%{name}-FTL %{_datadir}/%{name} %{_libexecdir}/%{name} %{_mandir}/man8/%{name}.8* %{_unitdir}/%{name}-FTL.service %{_sysconfdir}/bash_completion.d/%{name} %{_sysusersdir}/%{name}.conf # Files generated by Pi-hole at runtime %ghost %{_rundir}/pihole-FTL.pid %ghost %{_sysconfdir}/%{name}/dhcp.leases %ghost %{_sysconfdir}/%{name}/dnsmasq.conf %ghost %{_sysconfdir}/%{name}/gravity.db %ghost %{_sysconfdir}/%{name}/gravity_old.db %ghost %{_sysconfdir}/%{name}/hosts/custom.list %ghost %{_sysconfdir}/%{name}/local.list %ghost %{_sysconfdir}/%{name}/pihole-FTL.db %changelog * Fri Nov 15 2024 Mat Booth - 6.0-0.11.beta - Update to newest snapshots * Thu Nov 14 2024 Mat Booth - 6.0-0.10.beta - Update to 15th June snapshots and rebase patches * Thu Nov 14 2024 Mat Booth - 6.0-0.9.beta - Use mbedtls from base distro * Sun Mar 17 2024 Mat Booth - 6.0-0.8.beta - Really fix logrotate user * Sun Mar 17 2024 Mat Booth - 6.0-0.7.beta - Fix compilation errors caused by new GCC 14 warning - Fix logrotate user * Tue Mar 12 2024 Mat Booth - 6.0-0.6.beta - Update to newest snapshot * Wed Feb 14 2024 Mat Booth - 6.0-0.5.beta - Remove const attribute from the write_dnsmasq_config function to prevent it from being optimised out * Wed Feb 14 2024 Mat Booth - 6.0-0.4.beta - Ensure /var/lib directory is created * Tue Feb 13 2024 Mat Booth - 6.0-0.3.beta - Update snapshots for new reverse servers config * Wed Feb 07 2024 Mat Booth - 6.0-0.2.beta - Fix permissions of config dir * Mon Feb 05 2024 Mat Booth - 6.0-0.1.beta - Initial package