63 lines
1.3 KiB
Plaintext
63 lines
1.3 KiB
Plaintext
|
#!/sbin/runscript
|
||
|
# Copyright 1999-2010 Gentoo Foundation
|
||
|
# Distributed under the terms of the GNU General Public License v2
|
||
|
# $Header: $
|
||
|
|
||
|
depend()
|
||
|
{
|
||
|
before fsck
|
||
|
}
|
||
|
|
||
|
|
||
|
start()
|
||
|
{
|
||
|
# initramfs local-premount script for fixrtc (taken from Ubuntu initramfs)
|
||
|
ebegin "Setting Date to last mount time"
|
||
|
|
||
|
ROOTDEV=""
|
||
|
|
||
|
for x in $(cat /proc/cmdline); do
|
||
|
case ${x} in
|
||
|
root=*)
|
||
|
value=${x#*=}
|
||
|
# Find the device node path depending on the form of root= :
|
||
|
|
||
|
case ${value} in
|
||
|
UUID=*)
|
||
|
ROOTDEV=/dev/disk/by-uuid/${value#UUID=}
|
||
|
;;
|
||
|
LABEL=*)
|
||
|
ROOTDEV=/dev/disk/by-label/${value#LABEL=}
|
||
|
;;
|
||
|
*)
|
||
|
ROOTDEV=${value}
|
||
|
;;
|
||
|
esac
|
||
|
;;
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
if [ -n "$ROOTDEV" ];then
|
||
|
ROOTDISK=$(readlink -f "$ROOTDEV") &&
|
||
|
|
||
|
TIMESTR=$(dumpe2fs -h "$ROOTDISK" 2>/dev/null|grep "Last mount time") &&
|
||
|
TIME=${TIMESTR#*:} &&
|
||
|
|
||
|
date --set="${TIME} 1 minute" >/dev/null 2>&1 &&
|
||
|
hwclock --systohc >/dev/null 2>&1
|
||
|
fi
|
||
|
|
||
|
# This script is best-effort. If we couldn't fudge the clock as desired,
|
||
|
# just try to carry on boot anyway:
|
||
|
# It will probably fail, but we won't have made the situation any worse.
|
||
|
|
||
|
eend 0
|
||
|
}
|
||
|
|
||
|
stop()
|
||
|
{
|
||
|
ebegin "Nothing to do on shutdown"
|
||
|
eend 0
|
||
|
}
|
||
|
|