Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPM SPEC file #1550

Open
Thulium-Drake opened this issue Jul 18, 2024 · 0 comments
Open

RPM SPEC file #1550

Thulium-Drake opened this issue Jul 18, 2024 · 0 comments
Labels
🔨 enhancement New feature or request
Milestone

Comments

@Thulium-Drake
Copy link

Thulium-Drake commented Jul 18, 2024

Hi there,

Thanks for making this simple to use, but very powerful tool as a lightweight alternative to pi-hole :-)

I wrote a RPM SPEC file that will download the already compiled version from Github (I've never really bothered compiling Go stuff myself when it's already published on Github). It will download the specified version from Github (so if you have a script that will check on GH what the latest release is, you can have this SPEC file build you a package that will fit) and download the appropriate reference config file as well and add it as the example config in /etc/blocky

I've added it below in case it might inspire or help someone (don't mind the changelog, I needs a date and I wrote the SPEC I based this on back in January, I guess ;-) ):

Name:           blocky
Version:        %{version}
Release:        1%{?dist}
Summary:        Fast and lightweight DNS proxy as ad-blocker for local network with many features
BuildArch:      x86_64
License:        Apache 2.0
%undefine _disable_source_fetch
Source0:        https://github.com/0xERR0R/blocky/releases/download/v%{version}/blocky_v%{version}_Linux_x86_64.tar.gz

%description
Fast and lightweight DNS proxy as ad-blocker for local network with many features

%prep
rm -rf %{name}-%{version}
mkdir %{name}-%{version}
cd %{name}-%{version}
/usr/lib/rpm/rpmuncompress -vx %{_sourcedir}/%{name}_v%{version}_Linux_x86_64.tar.gz .
curl https://0xerr0r.github.io/blocky/v%{version}/config.yml > config.yml

%install
mkdir -p %{buildroot}/%{_sysconfdir}/%{name}
cp %{_builddir}/%{name}-%{version}/config.yml %{buildroot}/%{_sysconfdir}/%{name}/config.example.yml
mkdir -p %{buildroot}/%{_bindir}
cp %{_builddir}/%{name}-%{version}/%{name} %{buildroot}/%{_bindir}/%{name}
mkdir -p %{buildroot}/%{_docdir}/%{name}
cp %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/%{_docdir}/%{name}
cp %{_builddir}/%{name}-%{version}/README.md %{buildroot}/%{_docdir}/%{name}
mkdir -p %{buildroot}/lib/systemd/system
cp %{_specdir}/%{name}/%{name}.service %{buildroot}/lib/systemd/system

%clean
rm -rf %{buildroot}

%files
%{_sysconfdir}/%{name}/config.example.yml
%{_bindir}/%{name}
%{_docdir}/%{name}/LICENSE
%{_docdir}/%{name}/README.md
/lib/systemd/system/%{name}.service

%changelog
* Mon Jan 29 2024 Jeffrey van Pelt <[email protected]> - 0.0.1
- Initial RPM package

I also added a systemd Service to start it up accordingly:

[Unit]
Description=Blocky DNS server
After=network.target

[Service]
Restart=on-failure
ExecStart=/usr/sbin/blocky -c /etc/blocky/config.yml

[Install]
WantedBy=multi-user.target

When you have rpmbuild set up, you can build it as follows:

rpmbuild -bb -D '%version 0.24' SPECS/blocky.spec

If anyone has any points of improvement, feel free to comment below! 🚀

@kwitsch kwitsch added the 🔨 enhancement New feature or request label Jul 20, 2024
@kwitsch kwitsch added this to the future milestone Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants