Fix systemd/upstart to run cjdroute when *not* in openvz. :-P

This commit is contained in:
Stuart D. Gathman 2016-05-03 22:53:03 -04:00
parent 1257fc8db9
commit 8431b66717
1 changed files with 17 additions and 13 deletions

View File

@ -1,6 +1,6 @@
diff -up ./contrib/systemd/cjdns-online.sh.sbin ./contrib/systemd/cjdns-online.sh
--- ./contrib/systemd/cjdns-online.sh.sbin 2016-04-18 15:53:17.316245094 -0400
+++ ./contrib/systemd/cjdns-online.sh 2016-04-18 15:53:17.316245094 -0400
--- ./contrib/systemd/cjdns-online.sh.sbin 2016-05-03 22:06:45.820528693 -0400
+++ ./contrib/systemd/cjdns-online.sh 2016-05-03 22:06:45.820528693 -0400
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Check whether cjdns IPs are available
@ -78,8 +78,8 @@ diff -up ./contrib/systemd/cjdns-online.sh.sbin ./contrib/systemd/cjdns-online.s
+ cjdns_ips
+fi
diff -up ./contrib/systemd/cjdns-resume.service.sbin ./contrib/systemd/cjdns-resume.service
--- ./contrib/systemd/cjdns-resume.service.sbin 2016-04-18 15:53:17.316245094 -0400
+++ ./contrib/systemd/cjdns-resume.service 2016-04-18 15:53:17.316245094 -0400
--- ./contrib/systemd/cjdns-resume.service.sbin 2016-05-03 22:06:45.820528693 -0400
+++ ./contrib/systemd/cjdns-resume.service 2016-05-03 22:06:45.820528693 -0400
@@ -0,0 +1,10 @@
+[Unit]
+Description=Restart cjdns on resume from sleep
@ -93,8 +93,8 @@ diff -up ./contrib/systemd/cjdns-resume.service.sbin ./contrib/systemd/cjdns-res
+WantedBy=sleep.target
diff -up ./contrib/systemd/cjdns.service.sbin ./contrib/systemd/cjdns.service
--- ./contrib/systemd/cjdns.service.sbin 2016-01-27 03:07:49.000000000 -0500
+++ ./contrib/systemd/cjdns.service 2016-04-18 15:55:59.579483155 -0400
@@ -9,10 +9,10 @@ ProtectSystem=true
+++ ./contrib/systemd/cjdns.service 2016-05-03 22:50:07.241986902 -0400
@@ -9,10 +9,11 @@ ProtectSystem=true
SyslogIdentifier=cjdroute
ExecStartPre=/bin/sh -ec "if ! test -s /etc/cjdroute.conf; \
then umask 077; \
@ -103,14 +103,15 @@ diff -up ./contrib/systemd/cjdns.service.sbin ./contrib/systemd/cjdns.service
echo 'WARNING: A new /etc/cjdroute.conf file has been generated.'; \
- fi"
-ExecStart=/bin/sh -c "exec cjdroute --nobg < /etc/cjdroute.conf"
+ fi; test -c /dev/net/tun || /usr/sbin/modprobe tun"
+ fi; case $(wc -c /proc/modules) in \
+ 0*) ;; *) /sbin/modprobe tun;; esac"
+ExecStart=/bin/sh -c "exec /usr/sbin/cjdroute --nobg < /etc/cjdroute.conf"
Restart=always
[Install]
diff -up ./contrib/systemd/cjdns-wait-online.service.sbin ./contrib/systemd/cjdns-wait-online.service
--- ./contrib/systemd/cjdns-wait-online.service.sbin 2016-04-18 15:53:17.317245114 -0400
+++ ./contrib/systemd/cjdns-wait-online.service 2016-04-18 15:53:17.317245114 -0400
--- ./contrib/systemd/cjdns-wait-online.service.sbin 2016-05-03 22:06:45.820528693 -0400
+++ ./contrib/systemd/cjdns-wait-online.service 2016-05-03 22:06:45.820528693 -0400
@@ -0,0 +1,13 @@
+[Unit]
+Description=CJDNS Wait Online
@ -127,8 +128,8 @@ diff -up ./contrib/systemd/cjdns-wait-online.service.sbin ./contrib/systemd/cjdn
+WantedBy=multi-user.target
diff -up ./contrib/upstart/cjdns.conf.sbin ./contrib/upstart/cjdns.conf
--- ./contrib/upstart/cjdns.conf.sbin 2016-01-27 03:07:49.000000000 -0500
+++ ./contrib/upstart/cjdns.conf 2016-04-18 15:55:07.845450771 -0400
@@ -13,10 +13,13 @@ pre-start script
+++ ./contrib/upstart/cjdns.conf 2016-05-03 22:45:32.931860381 -0400
@@ -13,10 +13,16 @@ pre-start script
if ! [ -s /etc/cjdroute.conf ]; then
( # start a subshell to avoid side effects of umask later on
umask 077 # to create the file with 600 permissions without races
@ -139,11 +140,14 @@ diff -up ./contrib/upstart/cjdns.conf.sbin ./contrib/upstart/cjdns.conf
echo 'WARNING: A new cjdns cjdroute.conf file has been generated.'
fi
+ # preload tun driver, since we prevent module_request
+ test -c /dev/net/tun || /sbin/modprobe tun
+ case $(wc -c /proc/modules) in
+ 0*) ;;
+ *) /sbin/modprobe tun;;
+ esac
# If you need a non-standard setup, as described in
# https://github.com/cjdelisle/cjdns#non-standard-setups,
@@ -25,4 +28,4 @@ pre-start script
@@ -25,4 +31,4 @@ pre-start script
# see http://upstart.ubuntu.com/cookbook/#setuid
end script