Browse Source

Added centos packaging

pull/35/head
Luca Deri 6 years ago
parent
commit
6e62052eb0
  1. 26
      packages/centos/Makefile.in
  2. 2873
      packages/centos/configure
  3. 42
      packages/centos/configure.in
  4. 86
      packages/centos/n2n.spec.in
  5. 10
      packages/centos/rpm-sign.exp
  6. 2
      packages/debian/configure.in

26
packages/centos/Makefile.in

@ -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_VERS@-@REVISION@.$(PLATFORM).rpm
all: clean pkg
pkg:
rpmbuild -bb ./n2n.spec
@./rpm-sign.exp $(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

2873
packages/centos/configure

File diff suppressed because it is too large

42
packages/centos/configure.in

@ -0,0 +1,42 @@
AC_INIT([Makefile.in], 1.0)
MACHINE=`uname -m`
SHORT_MACHINE=`uname -m | cut -b1-3`
if test $MACHINE = "x86_64"; then
EXTN="amd64"
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
APP=n2n
N2N_VERS=`grep N2N_VERSION ../../Makefile | head -1| cut -d "=" -f 2`
GIT_RELEASE=`git rev-parse HEAD`
GIT_COMMITS=`git rev-list --all |wc -l | tr -d '[[:space:]]'`
DATE=`date -R`
REVISION=`git log --pretty=oneline | wc -l`
AC_SUBST(APP)
AC_SUBST(N2N_VERS)
AC_SUBST(MACHINE)
AC_SUBST(EXTN)
AC_SUBST(DATE)
AC_SUBST(GIT_RELEASE)
AC_SUBST(GIT_COMMITS)
AC_SUBST(REVISION)
AC_CONFIG_FILES(n2n.spec)
AC_CONFIG_FILES(../etc/systemd/system/edge.service)
AC_CONFIG_FILES(../etc/systemd/system/supernode.service)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT

86
packages/centos/n2n.spec.in

@ -0,0 +1,86 @@
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/
cp $HOME/n2n/packages/etc/n2n/*.conf $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/supernode.service
%config(noreplace) /etc/n2n/supernode.conf
%config(noreplace) /etc/n2n/edge.conf
# 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
/bin/systemctl enable edge.service
/bin/systemctl restart edge.service
/bin/systemctl enable supernode.service
/bin/systemctl restart supernode.service
fi
%preun
if [ ! -f /.dockerenv ]; then
/bin/systemctl disable edge.service
/bin/systemctl stop edge.service
/bin/systemctl disable supernode.service
/bin/systemctl stop supernode.service
fi

10
packages/centos/rpm-sign.exp

@ -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

2
packages/debian/configure.in

@ -9,12 +9,10 @@ else
if test $SHORT_MACHINE = "arm"; then if test $SHORT_MACHINE = "arm"; then
EXTN="armhf" EXTN="armhf"
EXTRA_DEPS="" EXTRA_DEPS=""
LIBRRD="librrd8, "
else else
if test $SHORT_MACHINE = "mip"; then if test $SHORT_MACHINE = "mip"; then
EXTN="mips" EXTN="mips"
EXTRA_DEPS="" EXTRA_DEPS=""
LIBRRD=""
else else
EXTN="i386" EXTN="i386"
fi fi

Loading…
Cancel
Save