Browse Source

Config files are installed with the .sample extension

You can now do 'cp edge.conf.sample edge.conf' to create a n2n configuration. If the .conf (for edge and supernode) are present, the service is enabled automatically. This prevents unwanted services to be enabled, and it preserves services activation across updates
pull/60/head
Luca Deri 6 years ago
parent
commit
b758d69e6c
  1. 4
      packages/debian/debian/conffiles
  2. 1
      packages/debian/debian/n2n.debhelper.log
  3. 2
      packages/debian/debian/n2n.postrm.debhelper
  4. 17
      packages/debian/debian/postinst
  5. 0
      packages/etc/n2n/edge.conf.sample
  6. 0
      packages/etc/n2n/supernode.conf.sample
  7. 23
      packages/rpm/n2n.spec.in

4
packages/debian/debian/conffiles

@ -1,2 +1,2 @@
/etc/n2n/edge.conf
/etc/n2n/supernode.conf
/etc/n2n/edge.conf.sample
/etc/n2n/supernode.conf.sample

1
packages/debian/debian/n2n.debhelper.log

@ -11,4 +11,3 @@ dh_link
dh_gencontrol
dh_md5sums
dh_builddeb
dh_builddeb

2
packages/debian/debian/n2n.postrm.debhelper

@ -1,4 +1,4 @@
# Automatically added by dh_installdebconf
# Automatically added by dh_installdebconf/11.1.6ubuntu2
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
db_purge

17
packages/debian/debian/postinst

@ -23,12 +23,21 @@ echo "Rebuilding ld cache..."
if [ -f /.dockerenv ]; then exit 0; fi
# Start service after upgrade/install
echo "(Re)Starting n2n..."
systemctl daemon-reload
systemctl reset-failed
# Do not start services automatically
#systemctl restart edge
#systemctl restart supernode
# Enable edge
if [ -f /etc/n2n/edge.conf ]; then
echo "Enabling n2n edge..."
systemctl enable edge
systemctl restart edge
fi
# Enable supernode
if [ -f /etc/n2n/supernode.conf ]; then
echo "Enabling n2n supernode..."
systemctl enable supernode
systemctl restart supernode
fi
exit 0

0
packages/etc/n2n/edge.conf → packages/etc/n2n/edge.conf.sample

0
packages/etc/n2n/supernode.conf → packages/etc/n2n/supernode.conf.sample

23
packages/rpm/n2n.spec.in

@ -49,8 +49,8 @@ rm -fr $RPM_BUILD_ROOT
/usr/lib/systemd/system/edge.service
/usr/lib/systemd/system/edge@.service
/usr/lib/systemd/system/supernode.service
%config(noreplace) /etc/n2n/supernode.conf
%config(noreplace) /etc/n2n/edge.conf
%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
@ -72,17 +72,26 @@ rm -fr $RPM_BUILD_ROOT
if [ ! -f /.dockerenv ]; then
/bin/systemctl daemon-reload
# Do not enable service automatically
#/bin/systemctl enable edge.service
#/bin/systemctl restart edge.service
#/bin/systemctl enable supernode.service
#/bin/systemctl restart supernode.service
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

Loading…
Cancel
Save