package/linuxptp: make initscript options configurable
PATCH 1/1 package/linuxptp: make initscript options configurable
Let the user supply its own options in /etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.
---
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
package/linuxptp/S65linuxptp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
package/linuxptp/S65linuxptp +21 -9
@@ -3,23 +3,35 @@ # Start linuxptp # +# defaults +PTP4L_OPTS="-f /etc/linuxptp.cfg" +PHC2SYS_ENABLE="true" +PHC2SYS_OPTS="-s eth0 -c CLOCK_REALTIME -w -S 1.0" + +# Read configuration variable file if it is present +[ -r /etc/default/linuxptp ] && . /etc/default/linuxptp + start() { printf "Starting linuxptp daemon: " start-stop-daemon -S -b -q -p /var/run/linuxptp-ptp4l.pid \ - -x /usr/sbin/ptp4l -- -f /etc/linuxptp.cfg + -x /usr/sbin/ptp4l -- ${PTP4L_OPTS} [ $? = 0 ] && echo "OK" || echo "FAIL" - printf "Starting linuxptp system clock synchronization: " - start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys -- -s eth0 -c CLOCK_REALTIME -w -S 1.0 - [ $? = 0 ] && echo "OK" || echo "FAIL" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Starting linuxptp system clock synchronization: " + start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys -- ${PHC2SYS_OPTS} + [ $? = 0 ] && echo "OK" || echo "FAIL" + fi } stop() { - printf "Stopping linuxptp system clock synchronization: " - start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys - echo "OK" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Stopping linuxptp system clock synchronization: " + start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys + echo "OK" + fi printf "Stopping linuxptp daemon: " start-stop-daemon -K -q -p /var/run/linuxptp-ptp4l.pid \
Signature · 1 line
2.20.1
PATCH 1/1 package/linuxptp: make initscript options configurable
Hi,
Am Fr., 6. M?rz 2020 um 11:19 Uhr schrieb Michael Walle <[email protected]>:
Quoted 9 lines
Let the user supply its own options in
/etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.Signed-off-by Michael Walle <[email protected]>---
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
I think 2 (ptp4l and phc2sys) scripts like done e.g. in debian would be better.
Quoted 54 lines
package/linuxptp/S65linuxptp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)package/linuxptp/S65linuxptp +21
-10@@ -3,23 +3,35 @@ # Start linuxptp # +# defaults +PTP4L_OPTS="-f /etc/linuxptp.cfg" +PHC2SYS_ENABLE="true" +PHC2SYS_OPTS="-s eth0 -c CLOCK_REALTIME -w -S 1.0" + +# Read configuration variable file if it is present +[ -r /etc/default/linuxptp ] && . /etc/default/linuxptp + start() { printf "Starting linuxptp daemon: " start-stop-daemon -S -b -q -p /var/run/linuxptp-ptp4l.pid \ - -x /usr/sbin/ptp4l -- -f /etc/linuxptp.cfg + -x /usr/sbin/ptp4l -- ${PTP4L_OPTS} [ $? = 0 ] && echo "OK" || echo "FAIL" - printf "Starting linuxptp system clock synchronization: " - start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys -- -s eth0 -c CLOCK_REALTIME -w -S 1.0 - [ $? = 0 ] && echo "OK" || echo "FAIL" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Starting linuxptp system clock synchronization: " + start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys -- ${PHC2SYS_OPTS} + [ $? = 0 ] && echo "OK" || echo "FAIL" + fi } stop() { - printf "Stopping linuxptp system clock synchronization: " - start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys - echo "OK" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Stopping linuxptp system clock synchronization: " + start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys + echo "OK" + fi printf "Stopping linuxptp daemon: " start-stop-daemon -K -q -p /var/run/linuxptp-ptp4l.pid \ --
Quoted 2 lines
2.20.1
Heiko
PATCH 1/1 package/linuxptp: make initscript options configurable
Quoted 8 lines · Heiko Thiery
Hi,
Am Fr., 6. M?rz 2020 um 11:19 Uhr schrieb Michael Walle <[email protected]>:
Quoted 4 lines
Let the user supply its own options in
/etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Michael Walle <[email protected]>---
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
I think 2 (ptp4l and phc2sys) scripts like done e.g. in debian would be better.
I agree. It can be split in S65linuxptp and S66linuxptp-phc2sys. Just remember to source /etc/default/linuxptp in both scripts or to support
a separate defaults file for linuxptp-phc2sys.
Signature · 1 line
Carlos Santos <[email protected]>
PATCH 1/1 package/linuxptp: make initscript options configurable
Hi Carlos, Michael and all,
Am Fr., 6. M?rz 2020 um 12:46 Uhr schrieb Carlos Santos <[email protected]>:
Quoted 13 lines · Heiko Thiery
Quoted 11 lines
Hi,
Am Fr., 6. M?rz 2020 um 11:19 Uhr schrieb Michael Walle <[email protected]>:
Quoted 7 lines
Let the user supply its own options in
/etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.Signed-off-by Michael Walle <[email protected]>---
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
I think 2 (ptp4l and phc2sys) scripts like done e.g. in debian would be better.
I agree. It can be split in S65linuxptp and S66linuxptp-phc2sys. Just remember to source
/etc/default/linuxptpin both scripts or to support
a separate defaults file for linuxptp-phc2sys.
I would suggest to create two scripts (S65ptp4l and S66phc2sys) and create support for the defaults of them (/etc/defaults/ptp4l and /etc/defaults/phc2sys).
Quoted 2 lines
--
Carlos Santos <[email protected]>
--
Heiko
PATCH 1/1 package/linuxptp: make initscript options configurable
In reply to Michael WalleQuoted 18 lines · Michael Walle
Let the user supply its own options in
/etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.Signed-off-by Michael Walle <[email protected]>---
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
package/linuxptp/S65linuxptp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)package/linuxptp/S65linuxptp +0
-0
package/linuxptp/S65linuxptp line 8
Quoted 6 lines
package/linuxptp/S65linuxptp +3
-0@@ -3,23 +3,35 @@ # Start linuxptp # +# defaults +PTP4L_OPTS="-f /etc/linuxptp.cfg" +PHC2SYS_ENABLE="true"
This is not required. An "exit" line in /etc/default/linuxptp suffices.
Quoted 45 lines
package/linuxptp/S65linuxptp +18
-10+PHC2SYS_OPTS="-s eth0 -c CLOCK_REALTIME -w -S 1.0" + +# Read configuration variable file if it is present +[ -r /etc/default/linuxptp ] && . /etc/default/linuxptp + start() { printf "Starting linuxptp daemon: " start-stop-daemon -S -b -q -p /var/run/linuxptp-ptp4l.pid \ - -x /usr/sbin/ptp4l -- -f /etc/linuxptp.cfg + -x /usr/sbin/ptp4l -- ${PTP4L_OPTS} [ $? = 0 ] && echo "OK" || echo "FAIL" - printf "Starting linuxptp system clock synchronization: " - start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys -- -s eth0 -c CLOCK_REALTIME -w -S 1.0 - [ $? = 0 ] && echo "OK" || echo "FAIL" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Starting linuxptp system clock synchronization: " + start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys -- ${PHC2SYS_OPTS} + [ $? = 0 ] && echo "OK" || echo "FAIL" + fi } stop() { - printf "Stopping linuxptp system clock synchronization: " - start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys - echo "OK" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Stopping linuxptp system clock synchronization: " + start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ + -x /usr/sbin/phc2sys + echo "OK" + fi printf "Stopping linuxptp daemon: " start-stop-daemon -K -q -p /var/run/linuxptp-ptp4l.pid \ --2.20.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 1 line
Carlos Santos <[email protected]>
PATCH 1/1 package/linuxptp: make initscript options configurable
Am 2020-03-06 12:40, schrieb Carlos Santos:
Quoted 23 lines · Michael Walle
Quoted 22 lines
Let the user supply its own options in
/etc/default/linuxptp. Additionally, let the user decide if he wants to start php2sys.Signed-off-by Michael Walle <[email protected]>---
It might be better to have an own php2sys initscript. I'm not sure. Thoughts?
package/linuxptp/S65linuxptp | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)package/linuxptp/S65linuxptp +0
-0@@ -3,23 +3,35 @@ # Start linuxptp #
Quoted 5 lines
package/linuxptp/S65linuxptp line 8
Quoted 3 lines
package/linuxptp/S65linuxptp +3
-0+# defaults +PTP4L_OPTS="-f /etc/linuxptp.cfg" +PHC2SYS_ENABLE="true"This is not required. An "exit" line in
/etc/default/linuxptpsuffices.
Please note that this is about the phc2sys, it will still start the ptp4l daemon. That being said.. I find it not really intuitive to have a control flow statement in a "configration" file.
BTW. Heiko just found out that the pid file creating isnt working and that killing the daemon doesn't work neither.
-michael
Quoted 51 lines
Quoted 51 lines
package/linuxptp/S65linuxptp +8
-6+PHC2SYS_OPTS="-s eth0 -c CLOCK_REALTIME -w -S 1.0" + +# Read configuration variable file if it is present +[ -r /etc/default/linuxptp ] && . /etc/default/linuxptp + start() { printf "Starting linuxptp daemon: " start-stop-daemon -S -b -q -p /var/run/linuxptp-ptp4l.pid \ - -x /usr/sbin/ptp4l -- -f /etc/linuxptp.cfg + -x /usr/sbin/ptp4l -- ${PTP4L_OPTS} [ $? = 0 ] && echo "OK" || echo "FAIL" - printf "Starting linuxptp system clock synchronization: " - start-stop-daemon -S -b -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys -- -s eth0 -c CLOCK_REALTIME -w -S 1.0 - [ $? = 0 ] && echo "OK" || echo "FAIL" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Starting linuxptp system clocksynchronization: "
+ start-stop-daemon -S -b -q -p/var/run/linuxptp-phc2sys.pid\package/linuxptp/S65linuxptp +5
-4+ -x /usr/sbin/phc2sys -- ${PHC2SYS_OPTS} + [ $? = 0 ] && echo "OK" || echo "FAIL" + fi } stop() { - printf "Stopping linuxptp system clock synchronization: " - start-stop-daemon -K -q -p /var/run/linuxptp-phc2sys.pid \ - -x /usr/sbin/phc2sys - echo "OK" + if [ "${PHC2SYS_ENABLE}" = "true" ]; then + printf "Stopping linuxptp system clocksynchronization: "
+ start-stop-daemon -K -q -p/var/run/linuxptp-phc2sys.pid\package/linuxptp/S65linuxptp +3
-1+ -x /usr/sbin/phc2sys + echo "OK" + fi printf "Stopping linuxptp daemon: " start-stop-daemon -K -q -p /var/run/linuxptp-ptp4l.pid \ --2.20.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot