File zerotier-one.spec of Package zerotier-one
#
# spec file for package zerotier-one
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# Using GCC instead of CLang as it is better Cross-Distribution-Wise
%global toolchain gcc
#
# There is no DEBUGGING for this ZeroTier package as it causes failing BUILDs on FEDORA 42+ / Rawhide
%global debug_package %{nil}
#
# For MAGEIA Only; Not defined there
%if 0%{?mageia}
%define _mandir %{_datadir}/man/
%endif
#
%define original_name ZeroTierOne
Name: zerotier-one
Version: 1.16.0
Release: 0
Summary: Smart Ethernet Switch and Virtual Private/Public Network for Earth
License: Apache-2.0 and BUSL-1.1 and GPL-3.0-only and MIT and MPL-2.0 and NonFree
URL: https://www.zerotier.com/
Source0: https://github.com/zerotier/%{original_name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: vendor-%{version}.tar.xz
Source2: %{name}-sysusers
BuildRequires: cargo
BuildRequires: coreutils
BuildRequires: gcc-c++
BuildRequires: groff
BuildRequires: gzip
BuildRequires: http-parser-devel
BuildRequires: nodejs-devel
BuildRequires: npm
BuildRequires: (passwd or shadow)
BuildRequires: pkgconfig
BuildRequires: rust
BuildRequires: util-linux
BuildRequires: systemd systemd-devel
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(sqlite3)
# BUILD REQUIREMENTS for SUSE
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse}
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(json)
%{?sysusers_requires}
%endif
#
# BUILD REQUIREMENTS for FEDORA
%if 0%{?fedora}
BuildRequires: initscripts-service
BuildRequires: json-devel
BuildRequires: redhat-rpm-config
BuildRequires: systemd-rpm-macros
%{?sysusers_requires_compat}
%endif
#
# BUILD REQUIREMENTS for MAGEIA
%if 0%{?mageia}
BuildRequires: json-devel
%{?sysusers_requires}
%endif
#
Requires: coreutils
Requires: openssl
Requires: systemd
Requires: util-linux
# REQUIRED by SUSE and FEDORA; Possibly for MAGEIA as well
%{?systemd_requires}
#
Provides: bundled(http-parser)
Provides: bundled(json) = 3.10.2
Provides: bundled(salsa2012)
%description
ZeroTier is a smart programmable VPN (Virtual Private/Public Network) that acts
as an Ethernet switch for planet Earth. It allows all networked devices, VMs,
containers, and applications to communicate as if they all reside in the same
physical data center or cloud region.
This is accomplished by combining a cryptographically addressed and secure peer
to peer network (termed VL1) with an Ethernet emulation layer somewhat similar
to VXLAN (termed VL2). Our VL2 Ethernet virtualization layer includes advanced
enterprise SDN features like fine grained access control rules for network
micro-segmentation and security monitoring.
All ZeroTier traffic is encrypted end-to-end using secret keys that only you
control. Most traffic flows peer to peer, though we offer free (but slow)
relaying for users who cannot establish peer to peer connections.
The goals and design principles of ZeroTier are inspired by among other things
the original Google BeyondCorp paper and the Jericho Forum with its notion of
"deperimeterization."
%prep
%autosetup -n %{original_name}-%{version}
mv -f "RELEASE-NOTES.md" -T "CHANGELOG.md"
pushd 'rustybits'
tar -xf %{SOURCE1}
popd
%build
%make_build \
ZT_USE_MINIUPNPC="1" \
STRIP="%{_bindir}/true" \
one
# Build MAN Pages with NPM
"doc/build.sh"
#
%install
%make_install
# Install SystemD SERVICE from SOURCE to SYSTEM
install -Dm644 "%{_builddir}/%{original_name}-%{version}/debian/%{name}.service" -t %{buildroot}/%{_unitdir}/
#
# Create and Configure SYSTEM USER & GROUP for ZeroTier
install -Dm644 %{SOURCE2} -T "%{buildroot}/%{_sysusersdir}/%{name}.conf"
#
# Convert & Install MAN Page(s)
gzip "doc/zerotier-cli.1" "doc/zerotier-idtool.1" "doc/%{name}.8"
install -Dm644 "doc/zerotier-cli.1.gz" -t "%{buildroot}/%{_mandir}/man1/"
install -Dm644 "doc/zerotier-idtool.1.gz" -t "%{buildroot}/%{_mandir}/man1/"
install -Dm644 "doc/%{name}.8.gz" -t "%{buildroot}/%{_mandir}/man8/"
#
# For SUSE Only - Create symbolic links from /usr/sbin/ to /usr/bin/ for compatibility & convenience
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse}
install -d %{buildroot}/%{_bindir}/
ln -fs %{_sbindir}/%{name} -t %{buildroot}/%{_bindir}/
ln -fs %{_sbindir}/%{name} -T "%{buildroot}/%{_bindir}/%{name}-cli"
ln -fs %{_sbindir}/%{name} -T "%{buildroot}/%{_bindir}/%{name}-idtool"
%endif
#
# Create SUSE/FEDORA-specific RC symlink for SystemD service
install -d %{buildroot}/{%{_bindir},%{_sbindir}}/
ln -fs "%{_sbindir}/service" -T "%{buildroot}/%{_sbindir}/rc%{name}"
#
%check
make selftest
'./zerotier-selftest'
%pre
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse} || 0%{?mageia}
%service_add_pre "%{name}.service"
%sysusers_create %{SOURCE2}
%else
%sysusers_create_compat %{SOURCE2}
%endif
%post
# Activate & Start ZeroTier One service after installation
%if 0%{?fedora}
%systemd_post "%{name}.service"
%else
%service_add_post "%{name}.service"
%endif
echo \
"*** Enable ZeroTier One SystemD service:
[systemctl enable --now zerotier-one.service]"
#
# Mention about public key location after installation
echo \
"*** Your ZeroTier public identity key of your device will be stored here:
[%{_sharedstatedir}/%{name}/identity.public]"
#
# Request Network ID from ZeroTier One VPN dashboard
echo \
"*** Copy <Network ID> of your custom network from the ZeroTier VPN dashboard (my.zerotier.com) then use the command & paste it:
[zerotier-cli join <NETWORK ID>]"
#
%preun
%if 0%{?fedora}
%systemd_preun "%{name}.service"
%else
%service_del_preun "%{name}.service"
%endif
%postun
%if 0%{?fedora}
%systemd_postun_with_restart "%{name}.service"
%else
%service_del_postun "%{name}.service"
%endif
%files
%doc "README.md" "CHANGELOG.md" "OFFICIAL-RELEASE-STEPS.md"
%license "LICENSE.txt" "LICENSE-MPL.txt" "ext/http-parser/LICENSE-MIT" "nonfree/LICENSE.md" "pkg/asustor/zerotier/CONTROL/license.txt"
# Conflicting RPM Macro of FEDORA 42+ / RAWHIDE with SUSE and MAGEIA; The install PATH is HardCoded to SBIN for ZeroTier;
# %%{_sbindir} macro cannot be used . . .
"/usr/sbin/%{name}"
"/usr/sbin/zerotier-cli"
"/usr/sbin/zerotier-idtool"
#
"%{_sbindir}/rc%{name}"
%{_mandir}/man1/zerotier-cli.1*%{?ext_man}
%{_mandir}/man1/zerotier-idtool.1*%{?ext_man}
%{_mandir}/man8/%{name}.8*%{?ext_man}
%dir %{_sharedstatedir}/%{name}/
%{_sharedstatedir}/%{name}/%{name}
"%{_sharedstatedir}/%{name}/%{name}.te"
"%{_sharedstatedir}/%{name}/zerotier-cli"
"%{_sharedstatedir}/%{name}/zerotier-idtool"
"%{_sysusersdir}/%{name}.conf"
"%{_unitdir}/%{name}.service"
# For SUSE Only
%if 0%{?sle_version} && 0%{?is_opensuse} || 0%{?suse_version} && 0%{?is_opensuse}
%{_bindir}/%{name}
"%{_bindir}/%{name}-cli"
"%{_bindir}/%{name}-idtool"
%endif
#
%changelog