Support up scripts

This commit is contained in:
Stuart D. Gathman 2017-01-13 22:09:50 -05:00
parent bd1824095a
commit da4d7ba091
2 changed files with 43 additions and 14 deletions

View File

@ -1,6 +1,6 @@
diff -up ./contrib/systemd/cjdns-loadmodules.service.sbin ./contrib/systemd/cjdns-loadmodules.service
--- ./contrib/systemd/cjdns-loadmodules.service.sbin 2016-08-15 13:39:48.892573194 -0400
+++ ./contrib/systemd/cjdns-loadmodules.service 2016-08-15 13:47:24.336772295 -0400
--- ./contrib/systemd/cjdns-loadmodules.service.sbin 2017-01-13 21:43:05.413731242 -0500
+++ ./contrib/systemd/cjdns-loadmodules.service 2017-01-13 21:43:05.413731242 -0500
@@ -0,0 +1,13 @@
+[Unit]
+Description=Load cjdns kernel modules
@ -16,8 +16,8 @@ diff -up ./contrib/systemd/cjdns-loadmodules.service.sbin ./contrib/systemd/cjdn
+[Install]
+WantedBy=multi-user.target
diff -up ./contrib/systemd/cjdns-online.sh.sbin ./contrib/systemd/cjdns-online.sh
--- ./contrib/systemd/cjdns-online.sh.sbin 2016-08-15 13:33:11.356021398 -0400
+++ ./contrib/systemd/cjdns-online.sh 2016-08-15 13:33:11.356021398 -0400
--- ./contrib/systemd/cjdns-online.sh.sbin 2017-01-13 21:43:05.414731254 -0500
+++ ./contrib/systemd/cjdns-online.sh 2017-01-13 21:43:05.414731254 -0500
@@ -0,0 +1,90 @@
+#!/bin/sh
+# Check whether cjdns IPs are available
@ -110,9 +110,9 @@ diff -up ./contrib/systemd/cjdns-online.sh.sbin ./contrib/systemd/cjdns-online.s
+ fi
+fi
diff -up ./contrib/systemd/cjdns.service.sbin ./contrib/systemd/cjdns.service
--- ./contrib/systemd/cjdns.service.sbin 2016-06-14 17:58:54.000000000 -0400
+++ ./contrib/systemd/cjdns.service 2016-08-15 13:56:20.198792714 -0400
@@ -1,18 +1,20 @@
--- ./contrib/systemd/cjdns.service.sbin 2016-10-11 17:39:44.000000000 -0400
+++ ./contrib/systemd/cjdns.service 2017-01-13 22:07:35.128118775 -0500
@@ -1,18 +1,21 @@
[Unit]
Description=cjdns: routing engine designed for security, scalability, speed and ease of use
Wants=network.target
@ -133,12 +133,13 @@ diff -up ./contrib/systemd/cjdns.service.sbin ./contrib/systemd/cjdns.service
fi"
-ExecStart=/bin/sh -c "exec cjdroute --nobg < /etc/cjdroute.conf"
+ExecStart=/bin/sh -c "exec /usr/sbin/cjdroute --nobg < /etc/cjdroute.conf"
+ExecStartPost=/bin/sh /usr/libexec/cjdns/cjdns-up
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-08-15 13:33:11.356021398 -0400
+++ ./contrib/systemd/cjdns-wait-online.service 2016-08-15 13:33:11.356021398 -0400
--- ./contrib/systemd/cjdns-wait-online.service.sbin 2017-01-13 21:43:05.414731254 -0500
+++ ./contrib/systemd/cjdns-wait-online.service 2017-01-13 21:43:05.414731254 -0500
@@ -0,0 +1,13 @@
+[Unit]
+Description=CJDNS Wait Online
@ -154,8 +155,8 @@ diff -up ./contrib/systemd/cjdns-wait-online.service.sbin ./contrib/systemd/cjdn
+[Install]
+WantedBy=multi-user.target
diff -up ./contrib/upstart/cjdns.conf.sbin ./contrib/upstart/cjdns.conf
--- ./contrib/upstart/cjdns.conf.sbin 2016-06-14 17:58:54.000000000 -0400
+++ ./contrib/upstart/cjdns.conf 2016-08-15 13:33:11.356021398 -0400
--- ./contrib/upstart/cjdns.conf.sbin 2016-10-11 17:39:44.000000000 -0400
+++ ./contrib/upstart/cjdns.conf 2017-01-13 21:45:35.268491363 -0500
@@ -13,10 +13,16 @@ pre-start script
if ! [ -s /etc/cjdroute.conf ]; then
( # start a subshell to avoid side effects of umask later on
@ -174,9 +175,15 @@ diff -up ./contrib/upstart/cjdns.conf.sbin ./contrib/upstart/cjdns.conf
# If you need a non-standard setup, as described in
# https://github.com/cjdelisle/cjdns#non-standard-setups,
@@ -25,4 +31,4 @@ pre-start script
@@ -25,4 +31,10 @@ pre-start script
# see http://upstart.ubuntu.com/cookbook/#setuid
end script
-exec /usr/bin/cjdroute --nobg < /etc/cjdroute.conf
+exec /usr/sbin/cjdroute --nobg < /etc/cjdroute.conf
+script
+ exec /usr/sbin/cjdroute --nobg < /etc/cjdroute.conf
+end script
+
+post-start script
+ . /usr/libexec/cjdns/cjdns-up
+end script

View File

@ -43,7 +43,7 @@
Name: cjdns
# major version is cjdns protocol version:
Version: 18
Release: 4%{?dist}
Release: 5%{?dist}
Summary: The privacy-friendly network without borders
Group: System Environment/Base
# cjdns is all GPLv3 except libuv which is MIT and BSD and ISC
@ -226,6 +226,20 @@ rm -rf contrib/nodejs # GPLv3 and ASL 2.0
%endif
rm -rf contrib/http # GPLv2 and MIT
cat >cjdns-up.sh <<'EOF'
#!/bin/sh
cjdev="$(cjdns-online -i)" || exit 1
for s in %{_sysconfdir}/cjdns/up.d/*.sh; do
if test -x "$s"; then
"$s" up $cjdev
fi
done
EOF
chmod a+x cjdns-up.sh
# FIXME: grep Version_CURRENT_PROTOCOL util/version/Version.h and
# check that it matches major %%{version}
@ -264,6 +278,7 @@ install -pm 644 contrib/upstart/cjdns.conf %{buildroot}%{_sysconfdir}/init
mkdir -p %{buildroot}%{_unitdir}
install -pm 644 contrib/systemd/cjdns*.service %{buildroot}%{_unitdir}
%endif
mkdir -p %{buildroot}%{_sysconfdir}/cjdns/up.d
# chroot
mkdir -p %{buildroot}/var/empty/cjdns
@ -286,6 +301,8 @@ rm -f contrib/nodejs/admin/.gitignore
cp -pr contrib/nodejs/admin %{buildroot}%{_libexecdir}/cjdns
%endif
cp -p cjdns-up.sh %{buildroot}%{_libexecdir}/cjdns-up
# symlinks for selected nodejs tools
mkdir -p %{buildroot}%{_bindir}
for t in peerStats sessionStats cjdnslog search dumpLinks dumptable \
@ -360,6 +377,8 @@ done
%if %{use_systemd}
%{_unitdir}/*
%endif
%dir %{_sysconfdir}/cjdns/up.d
%{_libexecdir}/cjdns/cjdns-up
%{_libexecdir}/cjdns/randombytes
%{_libexecdir}/cjdns/publictoip6
%{_libexecdir}/cjdns/privatetopublic
@ -485,6 +504,9 @@ fi
%{_bindir}/graphStats
%changelog
* Sat Jan 7 2017 Stuart D. Gathman <stuart@gathman.org> 18-5
- Run scripts in %{sysconfdir}/cjdns/up.d when cjdns comes up.
* Sun Nov 6 2016 Stuart D. Gathman <stuart@gathman.org> 18-4
- update cjdns-online man page
- Support ppc64, ppc64le, s390x