summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>2000-02-15 04:11:16 +0000
committerMatt Wilson <msw@redhat.com>2000-02-15 04:11:16 +0000
commit7663bc1e151d76e813fa1c4f2e1d3516f3c1d67f (patch)
tree6870184bc0c32ae86e346b143658a627c5d95b4f /iutil.py
parentb8b2999adc91dbdb8f75ad8e8c95035eca6a0087 (diff)
downloadanaconda-7663bc1e151d76e813fa1c4f2e1d3516f3c1d67f.tar.gz
anaconda-7663bc1e151d76e813fa1c4f2e1d3516f3c1d67f.tar.xz
anaconda-7663bc1e151d76e813fa1c4f2e1d3516f3c1d67f.zip
set system clock on upgrade
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/iutil.py b/iutil.py
index 06bfee75a..a2e3c0ff6 100644
--- a/iutil.py
+++ b/iutil.py
@@ -240,3 +240,40 @@ def validUser (user):
return 1
+def setClock (root):
+ # eeeeew, inline shell. ;)
+ args = ("bash", "-c", """
+if [ -f /etc/sysconfig/clock ]; then
+ . /etc/sysconfig/clock
+
+ # convert old style clock config to new values
+ if [ "${CLOCKMODE}" = "GMT" ]; then
+ UTC=true
+ elif [ "${CLOCKMODE}" = "ARC" ]; then
+ ARC=true
+ fi
+fi
+
+CLOCKFLAGS="--hctosys"
+
+case "$UTC" in
+ yes|true)
+ CLOCKFLAGS="$CLOCKFLAGS -u";
+ ;;
+esac
+
+case "$ARC" in
+ yes|true)
+ CLOCKFLAGS="$CLOCKFLAGS -A";
+ ;;
+esac
+case "$SRM" in
+ yes|true)
+ CLOCKFLAGS="$CLOCKFLAGS -S";
+ ;;
+esac
+/sbin/hwclock $CLOCKFLAGS
+""")
+ execWithRedirect('/bin/sh', args, stdin = None,
+ stdout = None, stderr = None,
+ root = root)