48 |
48 |
49 # |
49 # |
50 # Build the command line flags |
50 # Build the command line flags |
51 # |
51 # |
52 shift $# |
52 shift $# |
53 set -- -p /var/run/ntp.pid |
53 set -- --pidfile /var/run/ntp.pid |
54 # We allow a step larger than the panic value of 17 minutes only |
54 # We allow a step larger than the panic value of 17 minutes only |
55 # once when ntpd starts up. If always_allow_large_step is true, |
55 # once when ntpd starts up. If always_allow_large_step is true, |
56 # then we allow this each time ntpd starts. Otherwise, we allow |
56 # then we allow this each time ntpd starts. Otherwise, we allow |
57 # it only the very first time ntpd starts after a boot. We |
57 # it only the very first time ntpd starts after a boot. We |
58 # check that by making ntpd write its pid to a file in /var/run. |
58 # check that by making ntpd write its pid to a file in /var/run. |
59 |
59 |
60 val=`svcprop -c -p config/always_allow_large_step $SMF_FMRI` |
60 val=`svcprop -c -p config/always_allow_large_step $SMF_FMRI` |
61 if [ "$val" = "true" ] || \ |
61 if [ "$val" = "true" ] || \ |
62 [ ! -f /var/run/ntp.pid ]; then |
62 [ ! -f /var/run/ntp.pid ]; then |
63 set -- "$@" -g |
63 set -- "$@" --panicgate |
64 fi |
64 fi |
65 |
65 |
66 # Auth was off by default in xntpd now the default is on. Better have a way |
66 # Auth was off by default in xntpd now the default is on. Better have a way |
67 # to turn it off again. Also check for the obsolete "authentication" keyword. |
67 # to turn it off again. Also check for the obsolete "authentication" keyword. |
68 val=`svcprop -c -p config/no_auth_required $SMF_FMRI` |
68 val=`svcprop -c -p config/no_auth_required $SMF_FMRI` |
75 [ "$val" = "true" ] && set -- "$@" --authnoreq |
75 [ "$val" = "true" ] && set -- "$@" --authnoreq |
76 |
76 |
77 # Set up logging if requested. |
77 # Set up logging if requested. |
78 logfile=`svcprop -c -p config/logfile $SMF_FMRI` |
78 logfile=`svcprop -c -p config/logfile $SMF_FMRI` |
79 val=`svcprop -c -p config/verbose_logging $SMF_FMRI` |
79 val=`svcprop -c -p config/verbose_logging $SMF_FMRI` |
80 [ "$val" = "true" ] && [ -n "$logfile" ] && set -- "$@" -l $logfile |
80 [ "$val" = "true" ] && [ -n "$logfile" ] && set -- "$@" --logfile $logfile |
81 |
81 |
82 # Register with mDNS. |
82 # Register with mDNS. |
83 val=`svcprop -c -p config/mdnsregister $SMF_FMRI` |
83 val=`svcprop -c -p config/mdnsregister $SMF_FMRI` |
84 mdns=`svcprop -c -p general/enabled svc:/network/dns/multicast:default` |
84 mdns=`svcprop -c -p general/enabled svc:/network/dns/multicast:default` |
85 [ "$val" = "true" ] && [ "$mdns" = "true" ] && set -- "$@" -m |
85 [ "$val" = "true" ] && [ "$mdns" = "true" ] && set -- "$@" --mdns |
86 |
86 |
87 # We used to support the slewalways keyword, but that was a Sun thing |
87 # We used to support the slewalways keyword, but that was a Sun thing |
88 # and not in V4. Look for "slewalways yes" and set the new slew option. |
88 # and not in V4. Look for "slewalways yes" and set the new slew option. |
89 slew_always=`svcprop -c -p config/slew_always $SMF_FMRI` |
89 slew_always=`svcprop -c -p config/slew_always $SMF_FMRI` |
90 if [ ! "$slew_always" = "true" ]; then |
90 if [ ! "$slew_always" = "true" ]; then |
103 # a step once after a reboot if slew_always is set when allow_step_at_boot |
103 # a step once after a reboot if slew_always is set when allow_step_at_boot |
104 # is also set. |
104 # is also set. |
105 val=`svcprop -c -p config/allow_step_at_boot $SMF_FMRI` |
105 val=`svcprop -c -p config/allow_step_at_boot $SMF_FMRI` |
106 if [ "$val" = "true" ] && [ "$slew_always" = "true" ] && \ |
106 if [ "$val" = "true" ] && [ "$slew_always" = "true" ] && \ |
107 [ ! -f /var/run/ntp.pid ]; then |
107 [ ! -f /var/run/ntp.pid ]; then |
108 set -- "$@" -G |
108 set -- "$@" --force-step-once |
109 fi |
109 fi |
110 |
110 |
111 # Start the daemon. If debugging is requested, put it in the background, |
111 # Start the daemon. If debugging is requested, put it in the background, |
112 # since it won't do it on it's own. |
112 # since it won't do it on it's own. |
113 if [ "$deb" -gt 0 ]; then |
113 if [ "$deb" -gt 0 ]; then |