Commits

Andriy Kornatskyy committed b4f0e08

Added ability to disable ipv6

Comments (0)

Files changed (1)

 #!/bin/bash
 
 /etc/init.d/ntp stop
-mkdir -p /var/chroot/ntp/etc
 
-mv /etc/ntp.conf /var/chroot/ntp/etc
-ln -s /var/chroot/ntp/etc/ntp.conf /etc/ntp.conf
+rootfs=/var/chroot/ntp
+mkdir -p $rootfs/{etc,var/lib/ntp,var/log}
+
+mv /etc/ntp.conf $rootfs/etc
+ln -s $rootfs/etc/ntp.conf /etc/ntp.conf
+
+if [ -e /var/lib/ntp/ntp.drift ]; then
+    mv /var/lib/ntp/ntp.drift $rootfs/var/lib/ntp
+fi
+ln -s $rootfs/var/lib/ntp/ntp.drift \
+    /var/lib/ntp/ntp.drift
+chown -R ntp:ntp $rootfs/var/lib/ntp
+
+mv /var/log/ntpstats $rootfs/var/log
+ln -s $rootfs/var/log/ntpstats /var/log/ntpstats
+chown -R ntp:ntp $rootfs/var/log/ntpstats
 
 sed -e "s,'-g','-4 -i /var/chroot/ntp -g'," \
-   /etc/default/ntp > /tmp/x && \
-   mv /tmp/x /etc/default/ntp
+    /etc/default/ntp > /tmp/x && \
+    mv /tmp/x /etc/default/ntp
+
+sed -e "s,restrict -6,#restrict -6," \
+    -e "s,restrict ::1,#restrict ::1," \
+    /etc/ntp.conf > /tmp/x && \
+    mv /tmp/x /etc/ntp.conf
 
 /etc/init.d/ntp start
+