"Fossies" - the Fresh Open Source Software Archive

Member "n2n-3.1.1/packages/rpm/n2n.spec.in" (31 Mar 2022, 3148 Bytes) of package /linux/misc/n2n-3.1.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "n2n.spec.in": 3.0_vs_3.1.1.

    1 Summary: n2n peer-to-peer VPN
    2 Name: n2n
    3 Version: @N2N_VERSION_RPM@
    4 Release: 1
    5 License: GPL
    6 Group: Networking/Utilities
    7 URL: http://www.ntop.org/
    8 Source: n2n-%{version}.tgz
    9 Packager: Luca Deri <deri@ntop.org>
   10 # Temporary location where the RPM will be built
   11 BuildRoot:  %{_tmppath}/%{name}-%{version}-root
   12 Requires: libzstd
   13 
   14 # Make sure .build-id is not part of the package
   15 %define _build_id_links none
   16 
   17 %description
   18 n2n peer-to-peer VPN
   19 
   20 %prep
   21 
   22 %build
   23 
   24 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
   25 mkdir -p $RPM_BUILD_ROOT/etc/n2n
   26 mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
   27 cp $HOME/n2n/edge $RPM_BUILD_ROOT/usr/sbin
   28 cp $HOME/n2n/supernode $RPM_BUILD_ROOT/usr/sbin
   29 cp $HOME/n2n/n2n.7.gz $RPM_BUILD_ROOT/usr/share/man/man7
   30 cp $HOME/n2n/supernode.1.gz $RPM_BUILD_ROOT/usr/share/man/man1
   31 cp $HOME/n2n/edge.8.gz $RPM_BUILD_ROOT/usr/share/man/man8
   32 cp $HOME/n2n/packages/etc/systemd/system/*.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
   33 cp $HOME/n2n/packages/etc/n2n/*.conf.sample $RPM_BUILD_ROOT/etc/n2n
   34 
   35 find $RPM_BUILD_ROOT -name ".git" | xargs /bin/rm -rf
   36 find $RPM_BUILD_ROOT -name ".svn" | xargs /bin/rm -rf
   37 find $RPM_BUILD_ROOT -name "*~"   | xargs /bin/rm -f
   38 #
   39 DST=$RPM_BUILD_ROOT/usr/n2n
   40 SRC=$RPM_BUILD_DIR/%{name}-%{version}
   41 #mkdir -p $DST/conf
   42 # Clean out our build directory
   43 %clean
   44 rm -fr $RPM_BUILD_ROOT
   45 
   46 %files
   47 /usr/sbin/edge
   48 /usr/sbin/supernode
   49 /usr/share/man/man7/n2n.7.gz
   50 /usr/share/man/man1/supernode.1.gz
   51 /usr/share/man/man8/edge.8.gz
   52 /usr/lib/systemd/system/edge.service
   53 /usr/lib/systemd/system/edge@.service
   54 /usr/lib/systemd/system/edge-ntopng@.service
   55 /usr/lib/systemd/system/supernode.service
   56 %config(noreplace) /etc/n2n/supernode.conf.sample
   57 %config(noreplace) /etc/n2n/edge.conf.sample
   58 
   59 # Set the default attributes of all of the files specified to have an
   60 # owner and group of root and to inherit the permissions of the file
   61 # itself.
   62 %defattr(-, root, root)
   63 
   64 %changelog
   65 * Fri Aug 17 2018 Luca Deri <deri@ntop.org> 1.0
   66 - Current package version
   67 
   68 # Execution order:
   69 # install:    pre -> (copy) -> post
   70 # upgrade:    pre -> (copy) -> post -> preun (old) -> (delete old) -> postun (old)
   71 # un-install:                          preun       -> (delete)     -> postun
   72 
   73 %pre
   74 
   75 if ! grep -q n2n /etc/group; then
   76   echo 'Creating n2n group'
   77   /usr/sbin/groupadd -r n2n
   78 fi
   79 
   80 if ! /usr/bin/id -u n2n > /dev/null 2>&1; then
   81   echo 'Creating n2n user'
   82   /usr/sbin/useradd -M -N -g n2n -r -s /bin/false n2n
   83 fi
   84 
   85 %post
   86 if [ -f /bin/systemctl ]; then
   87   if [ ! -f /.dockerenv ]; then
   88       /bin/systemctl daemon-reload
   89       # NOTE: do not enable any services during first installation
   90   fi
   91 fi
   92 
   93 %preun
   94 if [ -f /bin/systemctl ]; then
   95   if [ ! -f /.dockerenv ]; then
   96       # possibly remove the installed services
   97       %systemd_preun supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service'
   98   fi
   99 fi
  100 
  101 %postun
  102 if [ -f /bin/systemctl ]; then
  103   if [ ! -f /.dockerenv ]; then
  104       # possibly restart the running services
  105       %systemd_postun_with_restart supernode.service edge.service 'edge-ntopng@*.service' 'edge@*.service'
  106   fi
  107 fi