;;; -*-conf-windows-*- ;;; ;;; systemd service configuration for the main tripe server. ;;; ;;; (c) 2014 Mark Wooding ;;; ;;;----- Licensing notice --------------------------------------------------- ;;; ;;; This file is part of Trivial IP Encryption (TrIPE). ;;; ;;; TrIPE is free software: you can redistribute it and/or modify it under ;;; the terms of the GNU General Public License as published by the Free ;;; Software Foundation; either version 3 of the License, or (at your ;;; option) any later version. ;;; ;;; TrIPE is distributed in the hope that it will be useful, but WITHOUT ;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ;;; for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with TrIPE. If not, see . [Unit] Description=Tripe virtual private network server Documentation=man:tripe(8) ConditionPathExists=@sbindir@/tripe ConditionPathExists=@bindir@/tripectl After=syslog.target network.target [Install] WantedBy=multi-user.target [Service] Type=forking PIDFile=/var/run/tripectl.pid ExecStart=/bin/sh -e -c ' \ . @initconfig@ && \ logopt= && \ case $${syslogp-nil} in nil) ;; *) logopt="$$logopt -l" ;; esac && \ case $${logfile+t},$${syslogp-nil} in \ t,*) logopt="$$logopt -f$$logfile" ;; \ ,nil) logopt="$$logopt -f@logfile@" ;; \ esac && \ exec @bindir@/tripectl -D -s -p@sbindir@/tripe \ -P/var/run/tripectl.pid \ $$logopt \ $${keytag+-S-t$$keytag} \ $${addr+-S-b$$addr} $${port+-S-p$$port} \ $${user+-U$$user} $${group+-G$$group} \ $${sockmode+-S-m$$sockmode} \ $${trace+-S-t$$trace} \ $${tunnel+-S-n$$tunnel} \ $$miscopts' ExecReload=@bindir@/tripectl RELOAD ExecStop=@bindir@/tripectl QUIT ExecStartPre=/bin/sh -e -c ' \ if { test -f /proc/misc && grep -q tun /proc/misc; } || \ modprobe -q tun; \ then \ : good; \ else \ echo >&2 "tripe needs the TUN/TAP driver"; exit 1; \ fi; \ if test -c /dev/net/tun; then \ : good; \ else \ echo >&2 "tripe needs /dev/net/tun, which is missing"; \ exit 1; \ fi' ExecStartPost=/bin/sh -e -c ' \ for i in 1 2 3 4 give-up; do \ @bindir@/tripectl HELP >/dev/null 2>&1 && break; \ sleep 1; \ done; \ case $$i in \ give-up) echo >&2 "tripe daemon failed to start"; exit 1 ;; \ esac'