Name: zerotier-one
Summary: ZeroTier One network virtualization service
Version: __VERSION__
Release: 1%{?dist}
License: GPLv3
URL: https://www.zerotier.com/

%description
ZeroTier One creates virtual Ethernet networks that work anywhere and everywhere.
Visit https://www.zerotier.com/ for more information.

%prep
mkdir -p $RPM_BUILD_ROOT/var/lib/zerotier-one/updates.d
cp -f $OLDPWD/__INSTALLER__ $RPM_BUILD_ROOT/var/lib/zerotier-one/updates.d

%pre
mkdir -p /var/lib/zerotier-one/updates.d

%files
/var/lib/zerotier-one/updates.d/__INSTALLER__

%post
chmod 0755 /var/lib/zerotier-one/updates.d/__INSTALLER__
/var/lib/zerotier-one/updates.d/__INSTALLER__

%preun
if [ "$1" -lt 1 ]; then
 /var/lib/zerotier-one/uninstall.sh
fi

%clean
cp -f %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm $OLDPWD
rm -f %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
rm -rf $RPM_BUILD_ROOT
