source: hybrid/branches/releng-11/nanobsd/files/tools/store-ntpdrift@ 14358

Last change on this file since 14358 was 10720, checked in by rick, 13 years ago

Plaats de handige tools in de ... tools directory :-)

  • Property svn:executable set to *
File size: 579 bytes
Line 
1#!/bin/sh
2# Back-up ntp.drift file changes to flash.
3
4SRC="/var/db/ntp.drift"
5DST="/cfg/local/ntp.drift"
6
7trap "umount /cfg" 1 2 15 EXIT
8
9EX_OK=0
10EX_NOINPUT=66
11EX_CANTCREAT=73
12
13mount -ro noatime /cfg
14
15# Check whether source exists
16if [ ! -r $SRC ]; then
17 echo "ERROR: '$SRC' not readable!" 1>&2
18 exit $EX_NOINPUT
19fi
20
21# Compare files, ignore white spaces, modification, etc
22diff -b -B -q ${SRC} ${DST}; RETVAL=$?
23if [ $RETVAL -ne 0 ]; then
24 # 2: DST does not yet, exists, 1: file differs
25 mount -uwo noatime /cfg
26 mkdir -p /cfg/local
27 cp ${SRC} ${DST}
28fi
29
30exit $EX_OK
Note: See TracBrowser for help on using the repository browser.