--- plamo/01_minimum/network.txz/old/ntp-20161013/PlamoBuild.ntp-4.2.8p8 2016-10-13 08:06:33.000000000 +0900 +++ plamo/01_minimum/network.txz/ntp/PlamoBuild.ntp-4.2.8p9 2017-01-16 20:53:07.000000000 +0900 @@ -1,18 +1,20 @@ #!/bin/sh ###################################################################### -url="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p8.tar.gz" +url="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p9.tar.gz" pkgbase=ntp -vers=4.2.8p8 +vers=4.2.8p9 arch=`uname -m` -build=P2 +build=P3 src=$pkgbase-$vers patchfiles="" OPT_CONFIG="" -DOCS="README.hackers README.bk NEWS WHERE-TO-START README.leapsmear - readme.y2kfixes CommitLog-4.1.0 README NOTES.y2kfixes CommitLog - COPYRIGHT INSTALL README.refclocks TODO ChangeLog README.versions - README.patches README.pullrequests" +DOCS="NEWS WHERE-TO-START COPYRIGHT README.hackers CommitLog-4.1.0 + README.pullrequests readme.y2kfixes CommitLog README ChangeLog + README.leapsmear README.versions NOTES.y2kfixes TODO README.bk + INSTALL README.refclocks README.patches" +template=20161020 +tmplurl=ftp://plamo.linet.gr.jp/pub/Plamo-src/admin ###################################################################### fscheck() { @@ -277,25 +279,34 @@ done install -d $P/etc cat <<- "EOF" > $P/etc/ntp.conf.new - # peer configuration for your host - # (expected to operate at stratum 3) + # Location of drift file + driftfile /var/lib/ntp/ntp.drift + + # NTP Servers server ntp1.jst.mfeed.ad.jp server ntp2.jst.mfeed.ad.jp server ntp3.jst.mfeed.ad.jp - driftfile /etc/ntp.drift + + # Restriction + restrict -4 default kod limited notrap nomodify nopeer noquery + restrict -6 default kod limited notrap nomodify nopeer noquery + restrict 127.0.0.1 + restrict ::1 EOF install -d $P/etc/rc.d/init.d cat <<- "EOF" > $P/etc/rc.d/init.d/ntp #!/bin/sh + NTPD_OPTS="-u ntp:ntp -p /var/run/ntpd.pid -g" + start() { - if ps ax | grep ntpd | grep -vq grep ; then + if pgrep -u ntp ntpd > /dev/null 2>&1 ; then echo "NTP daemon already running. NTP start aborted." exit 0 fi if [ -x /usr/bin/ntpd -a -f /etc/ntp.conf ] ; then ntpdate -s `sed -n '/^server/p' /etc/ntp.conf | cut -d' ' -f2` - ntpd -c /etc/ntp.conf + ntpd $NTPD_OPTS fi } @@ -303,6 +314,16 @@ killall ntpd } + status() { + if pgrep -u ntp ntpd > /dev/null 2>&1 ; then + echo "NTP daemon is running." + exit 0 + else + echo "NTP daemon is not running." + exit 1 + fi + } + case "$1" in start) start @@ -315,14 +336,19 @@ sleep 3 start ;; + status) + status + ;; *) - echo $"Usage: $0 {start|stop|restart}" + echo $"Usage: $0 {start|stop|restart|status}" exit 1 ;; esac exit 0 EOF chmod 755 $P/etc/rc.d/init.d/ntp + install -d $P/var/lib/ntp + chown ntp.ntp $P/var/lib/ntp touch $W/i.et cd $W find $P ! -type l -newer i.st ! -newer i.et \ @@ -339,22 +365,34 @@ if [ $i -eq 0 ] ; then install $myname $docdir/$src touch -t `date '+%m%d0900'` $docdir/$src/$myname - gzip_one $docdir/$src/$myname + tmpl=${myname%%.*}-template-$template + if [ -f ../admin/$tmpl ] ; then + cp -p ../admin/$tmpl $docdir/$src + else + ( cd $docdir/$src + curl -Rs -o $tmpl $tmplurl/${tmpl/${myname%%.*}/PlamoBuild} ) + fi + spec=${myname%%.*}-spec + ( cd $docdir/$src ; diff -u $tmpl $myname > $spec ) + touch -t `date '+%m%d0900'` $docdir/$src/$spec + gzip $docdir/$src/{$myname,$spec} + rm $docdir/$src/$tmpl + mv $docdir/$src/{$myname,$spec}.gz $C + mv $C/{$myname,$spec}.gz $docdir/$src else ln $docdir/$src/$myname.gz $docdir/${src[$i]} + ln $docdir/$src/$spec.gz $docdir/${src[$i]} fi ( cd $docdir ; find ${src[$i]} -type d -exec touch -r $W/{} {} \; ) done mv $docdir/sntp $docdir/$src mv $docdir/ntp $docdir/$src/html - mv $docdir/$src/{sntp,README.gz,html,{NOTES.y2kfixes,CommitLog}.gz} $C - mv $docdir/$src/{COPYRIGHT,INSTALL,README.refclocks,TODO,ChangeLog}.gz $C - mv $docdir/$src/{README.versions,README.patches,README.pullrequests}.gz $C - mv $docdir/$src/$myname.gz $C - mv $C/{sntp,README.gz,html,{NOTES.y2kfixes,CommitLog}.gz} $docdir/$src - mv $C/{COPYRIGHT,INSTALL,README.refclocks,TODO,ChangeLog}.gz $docdir/$src - mv $C/{README.versions,README.patches,README.pullrequests}.gz $docdir/$src - mv $C/$myname.gz $docdir/$src + mv $docdir/$src/{sntp,{README,ChangeLog,README.{leapsmear,versions}}.gz} $C + mv $docdir/$src/{NOTES.y2kfixes.gz,html,{TODO,README.bk,INSTALL}.gz} $C + mv $docdir/$src/{README.{refclocks,patches},$myname,$spec}.gz $C + mv $C/{sntp,{README,ChangeLog,README.{leapsmear,versions}}.gz} $docdir/$src + mv $C/{NOTES.y2kfixes.gz,html,{TODO,README.bk,INSTALL}.gz} $docdir/$src + mv $C/{README.{refclocks,patches},$myname,$spec}.gz $docdir/$src touch -r $S $docdir/$src convert install -d $P/install @@ -370,6 +408,7 @@ tar cvpf $pkg.tar -C $P `cd $P ; find usr/bin | tail -n+2` tar rvpf $pkg.tar -C $P usr/share/ntp tar rvpf $pkg.tar -C $P `cd $P ; find etc -type f` + tar rvpf $pkg.tar -C $P var/lib/ntp tar rvpf $pkg.tar -C $P `cd $P ; find usr/share/man/man1 | tail -n+2` tar rvpf $pkg.tar -C $P `cd $P ; find usr/share/man/man5 | tail -n+2` tar rvpf $pkg.tar -C $P `cd $P ; find usr/share/man/man8 | tail -n+2`