Add vcs fields to debian/control
[fake-hwclock.git] / fake-hwclock
1 #!/bin/sh
2 #
3 # Trivial script to load/save current contents of the kernel clock
4 # from/to a file. Helpful as a *bootstrap* clock on machines where
5 # there isn't a useful RTC driver (e.g. on development boards). Using
6 # NTP is still recommended on these machines to get to real time sync
7 # once more of the system is up and running.
8 #
9 # Copyright 2012 Steve McIntyre <93sam@debian.org>
10 #
11 # License: GPLv2, see COPYING
12
13 if [ "$FILE"x = ""x ] ; then
14     FILE=/etc/fake-hwclock.data
15 fi
16
17 COMMAND=$1
18 if [ "$COMMAND"x = ""x ] ; then
19     COMMAND="save"
20 fi
21
22 case $COMMAND in
23     save)
24         date -u '+%Y-%m-%d %H:%M:%S' > $FILE;;
25     load)
26         if [ -e $FILE ] ; then
27             date -u -s "`cat $FILE`"
28         else
29             echo "Unable to read saved clock information: $FILE does not exist"
30         fi;;
31     *)
32         echo $0: Unknown command $COMMAND
33         exit 1;;
34 esac