diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2014-08-21 23:19:59 +0200 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2014-08-24 03:48:21 +0200 |
commit | 1db5b4a96ea2bf8b6c25171cf42d7d78435adcbc (patch) | |
tree | 2b8e0ab946759826220bc00c0e964130e9f34985 /share/hooks/lxc/1030-util-linux.hook.chroot | |
parent | 7ce82acee7750bb004d2241b6e32a33a66e61746 (diff) | |
download | vyos-live-build-1db5b4a96ea2bf8b6c25171cf42d7d78435adcbc.tar.gz vyos-live-build-1db5b4a96ea2bf8b6c25171cf42d7d78435adcbc.zip |
Adding lxc specific hooks.
Diffstat (limited to 'share/hooks/lxc/1030-util-linux.hook.chroot')
-rwxr-xr-x | share/hooks/lxc/1030-util-linux.hook.chroot | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/share/hooks/lxc/1030-util-linux.hook.chroot b/share/hooks/lxc/1030-util-linux.hook.chroot new file mode 100755 index 000000000..1383e0bfe --- /dev/null +++ b/share/hooks/lxc/1030-util-linux.hook.chroot @@ -0,0 +1,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 |