mindref-sbin / chroot-ntp

Diff from to

chroot-ntp

 #!/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
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.