ntp: Resolve some abnormal behaviors
PATCH v2 1/1 ntp: Resolve some abnormal behaviors
The main changes include:
1). Add ntp:ntp(user:group) to system.
2). Running ntpd dameon as ntp:ntp.
3). Move relevant files from /usr/bin to /usr/sbin. 4). Add crypto support.
[YOCTO #4567]
[ CQID: WIND00417282 ]
--- meta-networking/recipes-support/ntp/files/ntpd | 8 ++++---- meta-networking/recipes-support/ntp/files/ntpdate | 6 +++--- meta-networking/recipes-support/ntp/ntp.inc | 20 ++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-)
meta-networking/recipes-support/ntp/files/ntpd +4 -4
@@ -1,7 +1,7 @@ #! /bin/sh # # ntpd init.d script for ntpdc from ntp.isc.org -test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 +test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 # rcS contains TICKADJ test -r /etc/default/rcS && . /etc/default/rcS
@@ -9,9 +9,9 @@ test -r /etc/default/rcS && . /etc/default/rcS settick(){ # If TICKADJ is set we *must* adjust it before we start, because the # driftfile relies on the correct setting - test -n "$TICKADJ" -a -x /usr/bin/tickadj && { + test -n "$TICKADJ" -a -x /usr/sbin/tickadj && { echo -n "Setting tick to $TICKADJ: " - /usr/bin/tickadj "$TICKADJ" + /usr/sbin/tickadj "$TICKADJ" echo "done" } }
@@ -21,7 +21,7 @@ startdaemon(){ # this. If ntpd seems to disappear after a while assume TICKADJ # above is set to a totally incorrect value. echo -n "Starting ntpd: " - start-stop-daemon --start -x /usr/bin/ntpd -- -p /var/run/ntp.pid "$@" + start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" echo "done" } stopdaemon(){
meta-networking/recipes-support/ntp/files/ntpdate +3 -3
@@ -1,8 +1,8 @@ #!/bin/sh -PATH=/sbin:/bin:/usr/bin +PATH=/sbin:/bin:/usr/bin:/usr/sbin -test -x /usr/bin/ntpdate || exit 0 +test -x /usr/sbin/ntpdate || exit 0 if test -f /etc/default/ntpdate ; then . /etc/default/ntpdate
@@ -40,7 +40,7 @@ if [ -x /usr/bin/lockfile-create ]; then LOCKTOUCHPID="$!" fi -if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then +if /usr/sbin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then if [ "$UPDATE_HWCLOCK" = "yes" ]; then hwclock --systohc || : fi
meta-networking/recipes-support/ntp/ntp.inc +12 -8
@@ -24,14 +24,19 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g file://sntp \ " -inherit autotools update-rc.d systemd +inherit autotools update-rc.d systemd useradd # The ac_cv_header_readline_history is to stop ntpdc depending on either # readline or curses -EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no" +EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no --with-binsubdir=sbin" CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" -PACKAGECONFIG ??= "" +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} = "--system --home /etc/ntp \ + --no-create-home --shell /bin/false \ + --user-group ntp" + +PACKAGECONFIG ??= "openssl" PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ --with-openssl-incdir=${STAGING_INCDIR} \ --with-crypto, \
@@ -91,10 +96,10 @@ RCONFLICTS_ntpdate += "ntpdate-systemd" RSUGGESTS_${PN} = "iana-etc" -FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}" -FILES_${PN}-tickadj = "${bindir}/tickadj" -FILES_${PN}-utils = "${bindir}" -FILES_ntpdate = "${bindir}/ntpdate \ +FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir}" +FILES_${PN}-tickadj = "${sbindir}/tickadj" +FILES_${PN}-utils = "${sbindir}" +FILES_ntpdate = "${sbindir}/ntpdate \ ${sysconfdir}/network/if-up.d/ntpdate-sync \ ${bindir}/ntpdate-sync \ ${sysconfdir}/default/ntpdate \
@@ -122,4 +127,3 @@ else fi fi } -
Signature · 1 line
1.7.0.2
This should be sent to [email protected] list.
Thanks
Sau!
Quoted 122 lines · Xufeng Zhang
The main changes include:
1). Add ntp:ntp(user:group) to system.
2). Running ntpd dameon as ntp:ntp.
3). Move relevant files from/usr/binto/usr/sbin. 4). Add crypto support.[YOCTO #4567]
[ CQID: WIND00417282 ]Signed-off-by Xufeng Zhang <[email protected]>--- meta-networking/recipes-support/ntp/files/ntpd | 8 ++++---- meta-networking/recipes-support/ntp/files/ntpdate | 6 +++--- meta-networking/recipes-support/ntp/ntp.inc | 20 ++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-)meta-networking/recipes-support/ntp/files/ntpd +4
-4@@ -1,7 +1,7 @@ #! /bin/sh # # ntpd init.d script for ntpdc from ntp.isc.org -test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 +test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 # rcS contains TICKADJ test -r /etc/default/rcS && . /etc/default/rcS@@ -9,9 +9,9 @@ test -r /etc/default/rcS && . /etc/default/rcS settick(){ # If TICKADJ is set we *must* adjust it before we start, because the # driftfile relies on the correct setting - test -n "$TICKADJ" -a -x /usr/bin/tickadj && { + test -n "$TICKADJ" -a -x /usr/sbin/tickadj && { echo -n "Setting tick to $TICKADJ: " - /usr/bin/tickadj "$TICKADJ" + /usr/sbin/tickadj "$TICKADJ" echo "done" } }@@ -21,7 +21,7 @@ startdaemon(){ # this. If ntpd seems to disappear after a while assume TICKADJ # above is set to a totally incorrect value. echo -n "Starting ntpd: " - start-stop-daemon --start -x /usr/bin/ntpd -- -p /var/run/ntp.pid "$@" + start-stop-daemon --start -x /usr/sbin/ntpd -- -u ntp:ntp -p /var/run/ntp.pid "$@" echo "done" } stopdaemon(){meta-networking/recipes-support/ntp/files/ntpdate +3
-3@@ -1,8 +1,8 @@ #!/bin/sh -PATH=/sbin:/bin:/usr/bin +PATH=/sbin:/bin:/usr/bin:/usr/sbin -test -x /usr/bin/ntpdate || exit 0 +test -x /usr/sbin/ntpdate || exit 0 if test -f /etc/default/ntpdate ; then . /etc/default/ntpdate@@ -40,7 +40,7 @@ if [ -x /usr/bin/lockfile-create ]; then LOCKTOUCHPID="$!" fi -if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then +if /usr/sbin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then if [ "$UPDATE_HWCLOCK" = "yes" ]; then hwclock --systohc || : fimeta-networking/recipes-support/ntp/ntp.inc +12
-8@@ -24,14 +24,19 @@ SRC_URI = "http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g file://sntp \ " -inherit autotools update-rc.d systemd +inherit autotools update-rc.d systemd useradd # The ac_cv_header_readline_history is to stop ntpdc depending on either # readline or curses -EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no" +EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no --with-binsubdir=sbin" CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED" -PACKAGECONFIG ??= "" +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} = "--system --home /etc/ntp \ + --no-create-home --shell /bin/false \ + --user-group ntp" + +PACKAGECONFIG ??= "openssl" PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ --with-openssl-incdir=${STAGING_INCDIR} \ --with-crypto, \@@ -91,10 +96,10 @@ RCONFLICTS_ntpdate += "ntpdate-systemd" RSUGGESTS_${PN} = "iana-etc" -FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}" -FILES_${PN}-tickadj = "${bindir}/tickadj" -FILES_${PN}-utils = "${bindir}" -FILES_ntpdate = "${bindir}/ntpdate \ +FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf ${sysconfdir}/init.d/ntpd ${libdir}" +FILES_${PN}-tickadj = "${sbindir}/tickadj" +FILES_${PN}-utils = "${sbindir}" +FILES_ntpdate = "${sbindir}/ntpdate \ ${sysconfdir}/network/if-up.d/ntpdate-sync \ ${bindir}/ntpdate-sync \ ${sysconfdir}/default/ntpdate \@@ -122,4 +127,3 @@ else fi fi } -
Quoted 2 lines · Saul Wold
This should be sent to [email protected] list.
Sorry for my mistake and thanks for your remind!
Thanks,
Xufeng
Quoted 138 lines
Thanks
Sau!Quoted 132 lines · Xufeng Zhang
The main changes include:
1). Add ntp:ntp(user:group) to system.
2). Running ntpd dameon as ntp:ntp.
3). Move relevant files from/usr/binto/usr/sbin. 4). Add crypto support.[YOCTO #4567]
[ CQID: WIND00417282 ]Signed-off-by Xufeng Zhang <[email protected]>--- meta-networking/recipes-support/ntp/files/ntpd | 8 ++++---- meta-networking/recipes-support/ntp/files/ntpdate | 6 +++--- meta-networking/recipes-support/ntp/ntp.inc | 20 ++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-)meta-networking/recipes-support/ntp/files/ntpd +1
-1@@ -1,7 +1,7 @@ #! /bin/sh # # ntpd init.d script for ntpdc from ntp.isc.org -test -x /usr/bin/ntpd -a -r /etc/ntp.conf || exit 0 +test -x /usr/sbin/ntpd -a -r /etc/ntp.conf || exit 0 # rcS contains TICKADJ test -r /etc/default/rcS && . /etc/default/rcS@@ -9,9 +9,9 @@ test -r /etc/default/rcS && . /etc/default/rcS settick(){ # If TICKADJ is set we *must* adjust it before we start,because the
# driftfile relies on the correct settingmeta-networking/recipes-support/ntp/files/ntpd +2
-3- test -n "$TICKADJ" -a -x /usr/bin/tickadj && { + test -n "$TICKADJ" -a -x /usr/sbin/tickadj && { echo -n "Setting tick to $TICKADJ: " - /usr/bin/tickadj "$TICKADJ" + /usr/sbin/tickadj "$TICKADJ" echo "done" } }@@ -21,7 +21,7 @@ startdaemon(){ # this. If ntpd seems to disappear after a while assume TICKADJ # above is set to a totally incorrect value. echo -n "Starting ntpd: " - start-stop-daemon --start -x /usr/bin/ntpd -- -p
/var/run/ntp.pid"$@"
+ start-stop-daemon --start -x/usr/sbin/ntpd-- -u ntp:ntp -p/var/run/ntp.pid"$@"
echo "done"
}
stopdaemon(){meta-networking/recipes-support/ntp/files/ntpdate +3
-3@@ -1,8 +1,8 @@ #!/bin/sh -PATH=/sbin:/bin:/usr/bin +PATH=/sbin:/bin:/usr/bin:/usr/sbin -test -x /usr/bin/ntpdate || exit 0 +test -x /usr/sbin/ntpdate || exit 0 if test -f /etc/default/ntpdate ; then . /etc/default/ntpdate@@ -40,7 +40,7 @@ if [ -x /usr/bin/lockfile-create ]; then LOCKTOUCHPID="$!" fi -if /usr/bin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then +if /usr/sbin/ntpdate -s $OPTS $NTPSERVERS 2>/dev/null; then if [ "$UPDATE_HWCLOCK" = "yes" ]; then hwclock --systohc || : fimeta-networking/recipes-support/ntp/ntp.inc +0
-0@@ -24,14 +24,19 @@ SRC_URI ="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-${PV}.tar.g
file://sntp \"
meta-networking/recipes-support/ntp/ntp.inc +1
-1-inherit autotools update-rc.d systemd +inherit autotools update-rc.d systemd useradd # The ac_cv_header_readline_history is to stop ntpdc depending oneither
# readline or curses -EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no" +EXTRA_OECONF += "--with-net-snmp-config=no --without-ntpsnmpd ac_cv_header_readline_history_h=no --with-binsubdir=sbin" CFLAGS_append = " -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED"meta-networking/recipes-support/ntp/ntp.inc +6
-2-PACKAGECONFIG ??= "" +USERADD_PACKAGES = "${PN}" +USERADD_PARAM_${PN} = "--system --home /etc/ntp \ + --no-create-home --shell /bin/false \ + --user-group ntp" + +PACKAGECONFIG ??= "openssl" PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ --with-openssl-incdir=${STAGING_INCDIR} \ --with-crypto, \@@ -91,10 +96,10 @@ RCONFLICTS_ntpdate += "ntpdate-systemd" RSUGGESTS_${PN} = "iana-etc" -FILES_${PN} = "${bindir}/ntpd ${sysconfdir}/ntp.conf${sysconfdir}/init.d/ntpd ${sbindir} ${libdir}"
meta-networking/recipes-support/ntp/ntp.inc +1
-3-FILES_${PN}-tickadj = "${bindir}/tickadj" -FILES_${PN}-utils = "${bindir}" -FILES_ntpdate = "${bindir}/ntpdate \ +FILES_${PN} = "${sbindir}/ntpd ${sysconfdir}/ntp.conf${sysconfdir}/init.d/ntpd ${libdir}"
meta-networking/recipes-support/ntp/ntp.inc +3
-1+FILES_${PN}-tickadj = "${sbindir}/tickadj" +FILES_${PN}-utils = "${sbindir}" +FILES_ntpdate = "${sbindir}/ntpdate \ ${sysconfdir}/network/if-up.d/ntpdate-sync \ ${bindir}/ntpdate-sync \ ${sysconfdir}/default/ntpdate \@@ -122,4 +127,3 @@ else fi fi } -