5da07a33c698 — Malcolm Scott tip 7 years ago
Add systemd service
3 files changed, 16 insertions(+), 2 deletions(-)

M debian/control
M debian/rules
A => debian/service
M debian/control +1 -1
@@ 3,7 3,7 @@ Maintainer: Malcolm Scott <debianpkg@mal
 Section: net
 Priority: optional
 Standards-Version: 3.9.5
-Build-Depends: debhelper (>= 9)
+Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5)
 
 Package: nfw-redirector
 Architecture: all

          
M debian/rules +1 -1
@@ 1,4 1,4 @@ 
 #!/usr/bin/make -f
 
 %:
-	dh $@
+	dh $@ --with-systemd

          
A => debian/service +14 -0
@@ 0,0 1,14 @@ 
+[Unit]
+Description=nfw captive portal redirector
+After=network.target
+
+[Service]
+Environment=BIND_ADDRESS=localhost BIND_PORT=8080 URL=https://nfw.example.org/enrol
+EnvironmentFile=-/etc/default/nfw-redirector
+ExecStart=/usr/bin/nfw-redirector --bind-address ${BIND_ADDRESS} --bind-port ${BIND_PORT} ${URL}
+Restart=on-failure
+User=nobody
+
+[Install]
+WantedBy=multi-user.target
+