New upstream version 3.1.1

This commit is contained in:
billchenchina 2022-11-15 08:50:35 +08:00
parent 4e9934e5ec
commit e7b41df57b
229 changed files with 57000 additions and 12055 deletions

26
packages/rpm/Makefile.in Normal file
View file

@ -0,0 +1,26 @@
#
# Change it according to your setup
#
N2N_HOME=$(PWD)/../..
N2N_BUILD=${N2N_HOME}/packages/debian/n2n
PLATFORM=@MACHINE@
RPM_PKG=n2n-@N2N_VERSION_RPM@-1.$(PLATFORM).rpm
all: clean pkg
pkg:
rpmbuild -bb ./n2n.spec
-@@RPM_SIGN_CMD@ $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)
@echo ""
@echo "Package contents:"
@rpm -qpl $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)
@echo "The package is now available in $(HOME)/rpmbuild/RPMS/$(PLATFORM)/$(RPM_PKG)"
distclean:
echo "dummy distclean"
install:
echo "dummy install"
clean:
rm -rf *~ *rpm

2901
packages/rpm/configure vendored Executable file

File diff suppressed because it is too large Load diff

56
packages/rpm/configure.in Normal file
View file

@ -0,0 +1,56 @@
AC_INIT([Makefile.in], 1.0)
# NOTE: this file is not actually used. You need to edit configure as well!
N2N_VERSION_RPM=$(../../scripts/version.sh |tr - _)
MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3`
if test $MACHINE = "x86_64"; then
EXTN="amd64"
else
if test $SHORT_MACHINE = "aar"; then
EXTN="arm64"
EXTRA_DEPS=""
else
if test $SHORT_MACHINE = "arm"; then
EXTN="armhf"
EXTRA_DEPS=""
else
if test $SHORT_MACHINE = "mip"; then
EXTN="mips"
EXTRA_DEPS=""
else
EXTN="i386"
fi
fi
fi
fi
APP=n2n
DATE=`date -R`
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1`
if test $CENTOS_RELEASE = "release"; then
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1`
fi
RPM_SIGN_CMD="rpm --addsign"
if test "$CENTOS_RELEASE" -ne 8; then
RPM_SIGN_CMD="./rpm-sign.exp"
fi
AC_SUBST(APP)
AC_SUBST(MACHINE)
AC_SUBST(N2N_VERSION_RPM)
AC_SUBST(EXTN)
AC_SUBST(DATE)
AC_SUBST(RPM_SIGN_CMD)
AC_CONFIG_FILES(n2n.spec)
AC_CONFIG_FILES(../etc/systemd/system/edge.service)
AC_CONFIG_FILES(../etc/systemd/system/edge@.service)
AC_CONFIG_FILES(../etc/systemd/system/edge-ntopng@.service)
AC_CONFIG_FILES(../etc/systemd/system/supernode.service)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

107
packages/rpm/n2n.spec.in Normal file
View file

@ -0,0 +1,107 @@
Summary: n2n peer-to-peer VPN
Name: n2n
Version: @N2N_VERSION_RPM@
Release: 1
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: libzstd
# Make sure .build-id is not part of the package
%define _build_id_links none
%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/
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
if ! grep -q n2n /etc/group; then
echo 'Creating n2n group'
/usr/sbin/groupadd -r n2n
fi
if ! /usr/bin/id -u n2n > /dev/null 2>&1; then
echo 'Creating n2n user'
/usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n
fi
%post
if [ -f /bin/systemctl ]; then
if [ ! -f /.dockerenv ]; then
/bin/systemctl daemon-reload
# NOTE: do not enable any services during first installation
fi
fi
%preun
if [ -f /bin/systemctl ]; then
if [ ! -f /.dockerenv ]; then
# possibly remove the installed services
%systemd_preun supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service'
fi
fi
%postun
if [ -f /bin/systemctl ]; then
if [ ! -f /.dockerenv ]; then
# possibly restart the running services
%systemd_postun_with_restart supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service'
fi
fi

10
packages/rpm/rpm-sign.exp Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/expect -f
### rpm-sign.exp -- Sign RPMs by sending the passphrase.
spawn rpm --addsign {*}$argv
expect -exact "Enter pass phrase: "
send -- "\r"
expect eof
## end of rpm-sign.exp