You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.7 KiB

Summary: n2n peer-to-peer VPN
Name: n2n
Version: @N2N_VERS@
Release: @REVISION@
License: GPL
Group: Networking/Utilities
URL: http://www.ntop.org/
Source: n2n-%{version}.tgz
Packager: Luca Deri <deri@ntop.org>
# Temporary location where the RPM will be built
BuildRoot: %{_tmppath}/%{name}-%{version}-root
#Requires: ntopng
%description
n2n peer-to-peer VPN
%prep
%build
mkdir -p $RPM_BUILD_ROOT/usr/sbin $RPM_BUILD_ROOT/usr/share/man/man1 $RPM_BUILD_ROOT/usr/share/man/man7 $RPM_BUILD_ROOT/usr/share/man/man8
mkdir -p $RPM_BUILD_ROOT/etc/n2n
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
cp $HOME/n2n/edge $RPM_BUILD_ROOT/usr/sbin
cp $HOME/n2n/supernode $RPM_BUILD_ROOT/usr/sbin
cp $HOME/n2n/n2n.7.gz $RPM_BUILD_ROOT/usr/share/man/man7
cp $HOME/n2n/supernode.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
cp $HOME/n2n/edge.8.gz $RPM_BUILD_ROOT/usr/share/man/man8
cp $HOME/n2n/packages/etc/systemd/system/*.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
6 years ago
cp $HOME/n2n/packages/etc/n2n/*.conf.sample $RPM_BUILD_ROOT/etc/n2n
find $RPM_BUILD_ROOT -name ".git" | xargs /bin/rm -rf
find $RPM_BUILD_ROOT -name ".svn" | xargs /bin/rm -rf
find $RPM_BUILD_ROOT -name "*~" | xargs /bin/rm -f
#
DST=$RPM_BUILD_ROOT/usr/n2n
SRC=$RPM_BUILD_DIR/%{name}-%{version}
#mkdir -p $DST/conf
# Clean out our build directory
%clean
rm -fr $RPM_BUILD_ROOT
%files
/usr/sbin/edge
/usr/sbin/supernode
/usr/share/man/man7/n2n.7.gz
/usr/share/man/man1/supernode.1.gz
/usr/share/man/man8/edge.8.gz
/usr/lib/systemd/system/edge.service
/usr/lib/systemd/system/edge@.service
/usr/lib/systemd/system/edge-ntopng@.service
/usr/lib/systemd/system/supernode.service
%config(noreplace) /etc/n2n/supernode.conf.sample
%config(noreplace) /etc/n2n/edge.conf.sample
# Set the default attributes of all of the files specified to have an
# owner and group of root and to inherit the permissions of the file
# itself.
%defattr(-, root, root)
%changelog
* Fri Aug 17 2018 Luca Deri <deri@ntop.org> 1.0
- Current package version
# Execution order:
# install: pre -> (copy) -> post
# upgrade: pre -> (copy) -> post -> preun (old) -> (delete old) -> postun (old)
# un-install: preun -> (delete) -> postun
%pre
%post
if [ ! -f /.dockerenv ]; then
/bin/systemctl daemon-reload
if [ -f /etc/n2n/edge.conf ]; then
/bin/systemctl enable edge.service
/bin/systemctl restart edge.service
fi
if [ -f /etc/n2n/supernode.conf ]; then
/bin/systemctl enable supernode.service
/bin/systemctl restart supernode.service
fi
fi
%preun
if [ ! -f /.dockerenv ]; then
if [ -f /etc/n2n/edge.conf ]; then
/bin/systemctl disable edge.service
/bin/systemctl stop edge.service
fi
if [ -f /etc/n2n/supernode.conf ]; then
/bin/systemctl disable supernode.service
/bin/systemctl stop supernode.service
fi
fi