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
This commit is contained in:
Luca Deri 2018-12-01 08:36:58 +01:00
parent b84cedd8b8
commit b758d69e6c
7 changed files with 32 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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