From 92faeb54ad2e52b4ec874879bf5bc89cce03273b Mon Sep 17 00:00:00 2001 From: Emanuele Faranda Date: Wed, 28 Nov 2018 13:04:44 +0100 Subject: [PATCH] Add support for multi-service n2n edge E.g. systemctl start edge@n2n1 will read /etc/n2n/edge-n2n1.conf --- packages/debian/configure | 3 +++ packages/debian/configure.in | 1 + packages/etc/systemd/system/edge@.service.in | 15 +++++++++++++++ packages/rpm/configure | 3 +++ packages/rpm/configure.in | 1 + packages/rpm/n2n.spec.in | 1 + 6 files changed, 24 insertions(+) create mode 100644 packages/etc/systemd/system/edge@.service.in diff --git a/packages/debian/configure b/packages/debian/configure index cfe9fcb..6cd6133 100755 --- a/packages/debian/configure +++ b/packages/debian/configure @@ -1726,6 +1726,8 @@ ac_config_files="$ac_config_files debian/rules" ac_config_files="$ac_config_files ../etc/systemd/system/edge.service" +ac_config_files="$ac_config_files ../etc/systemd/system/edge@.service" + ac_config_files="$ac_config_files ../etc/systemd/system/supernode.service" ac_config_files="$ac_config_files Makefile" @@ -2440,6 +2442,7 @@ do "debian/control") CONFIG_FILES="$CONFIG_FILES debian/control" ;; "debian/rules") CONFIG_FILES="$CONFIG_FILES debian/rules" ;; "../etc/systemd/system/edge.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge.service" ;; + "../etc/systemd/system/edge@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge@.service" ;; "../etc/systemd/system/supernode.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/supernode.service" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; diff --git a/packages/debian/configure.in b/packages/debian/configure.in index 4eb56a5..168d57a 100644 --- a/packages/debian/configure.in +++ b/packages/debian/configure.in @@ -38,6 +38,7 @@ AC_CONFIG_FILES(debian/files) AC_CONFIG_FILES(debian/control) AC_CONFIG_FILES(debian/rules) AC_CONFIG_FILES(../etc/systemd/system/edge.service) +AC_CONFIG_FILES(../etc/systemd/system/edge@.service) AC_CONFIG_FILES(../etc/systemd/system/supernode.service) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/packages/etc/systemd/system/edge@.service.in b/packages/etc/systemd/system/edge@.service.in new file mode 100644 index 0000000..42516c5 --- /dev/null +++ b/packages/etc/systemd/system/edge@.service.in @@ -0,0 +1,15 @@ +[Unit] +Description=n2n edge process, on %I +After=network.target syslog.target +Wants= + +[Service] +Type=simple +ExecStartPre= +ExecStart=/usr/sbin/edge /etc/n2n/edge-%i.conf -f +Restart=on-abnormal +RestartSec=5 + +[Install] +WantedBy=multi-user.target +Alias= diff --git a/packages/rpm/configure b/packages/rpm/configure index 061a2e5..2e1be98 100755 --- a/packages/rpm/configure +++ b/packages/rpm/configure @@ -1709,6 +1709,8 @@ ac_config_files="$ac_config_files n2n.spec" ac_config_files="$ac_config_files ../etc/systemd/system/edge.service" +ac_config_files="$ac_config_files ../etc/systemd/system/edge@.service" + ac_config_files="$ac_config_files ../etc/systemd/system/supernode.service" ac_config_files="$ac_config_files Makefile" @@ -2420,6 +2422,7 @@ do case $ac_config_target in "n2n.spec") CONFIG_FILES="$CONFIG_FILES n2n.spec" ;; "../etc/systemd/system/edge.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge.service" ;; + "../etc/systemd/system/edge@.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/edge@.service" ;; "../etc/systemd/system/supernode.service") CONFIG_FILES="$CONFIG_FILES ../etc/systemd/system/supernode.service" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; diff --git a/packages/rpm/configure.in b/packages/rpm/configure.in index 9e274be..cddb0b4 100644 --- a/packages/rpm/configure.in +++ b/packages/rpm/configure.in @@ -37,6 +37,7 @@ AC_SUBST(REVISION) 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/supernode.service) AC_CONFIG_FILES(Makefile) AC_OUTPUT diff --git a/packages/rpm/n2n.spec.in b/packages/rpm/n2n.spec.in index bdf53fa..5d44271 100644 --- a/packages/rpm/n2n.spec.in +++ b/packages/rpm/n2n.spec.in @@ -47,6 +47,7 @@ rm -fr $RPM_BUILD_ROOT /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/supernode.service %config(noreplace) /etc/n2n/supernode.conf.sample %config(noreplace) /etc/n2n/edge.conf.sample