blob: 1383e0bfe8146a7a7508158ac9ef7676ec49da31 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#!/bin/sh
set -e
# /etc/default/hwclock is supported as of util-linux version 2.20.1-5
_UTIL_LINUX_VERSION="$(dpkg -l util-linux | awk '/^ii/ { print $3 }')"
if dpkg --compare-versions "${_UTIL_LINUX_VERSION}" lt 2.20.1-5~
then
exit 0
fi
if [ -e /etc/default/hwclock ]
then
. /etc/default/hwclock
# HWCLOCKACCESS is commented in /etc/default/hwclock
if [ -z "${HWCLOCKACCESS}" ]
then
# uncommenting it
sed -e "s|^# *HWCLOCKACCESS=|HWCLOCKACCESS=|" \
/etc/default/hwclock > /etc/default/hwclock.tmp
else
cp /etc/default/hwclock /etc/default/hwclock.tmp
fi
else
touch /etc/default/hwclock.tmp
fi
# Set the hwclock parameters
grep -Eq '^ *HWCLOCKACCESS=' /etc/default/hwclock.tmp || \
echo "HWCLOCKACCESS=" >> /etc/default/hwclock.tmp
sed -i -e "s|^ *HWCLOCKACCESS=.*|HWCLOCKACCESS=\"${_HWCLOCKACCESS}\"|" \
/etc/default/hwclock.tmp
mv /etc/default/hwclock.tmp /etc/default/hwclock
|