1. Moises Henriquez
  2. vasm

Commits

M0E-lnx  committed 8ed431c

Added hwclock setting code

  • Participants
  • Parent commits 625023c
  • Branches default

Comments (0)

Files changed (2)

File modules/support/vectorlinux/DATESET.py

View file
  • Ignore whitespace
                 if self._line_sets_value(line):
                     line = "%s\n"% value
                 newdata.append(line)
-
         f = open(self.descriptor, 'w')
         f.writelines(''.join(newdata))
         f.close()
         """ remove the symlink that sets the timezone """
         return  os.remove(self.tzlink)
 
+    def _check_faulty_rtcports(self):
+        """ Check /proc/ioports for unknown rtc ports """
+        # This comes from the old vasm scripts.
+        # Check for a broken motherboard rtc clock (where ioports for
+        # rtc are unknown) to prevent hwclock from causing a hang.
+        ret = True
+        proc = utils.get_popen(['cat', '/proc/ioports'])
+        output = proc.communicate()[0].split("\n")
+        for line in output:
+            if 'rtc' in line:
+                ret = False
+                break
+        return ret
+
+    def _active_zone(self):
+        """ Active the selected zone """
+        if self._check_faulty_rtcports():
+            clock_opt = "--directisa"
+        else:
+            clock_opt = ""
+        ctype = HWClock().get_value().lower()
+        cm = ['/sbin/hwclock', clock_opt, '--%s'% ctype, '--hctosys']
+        proc = utils.get_popen(cm)
+        proc.communicate()
+        rval = proc.returncode
+        return rval > 0
+
     def set_zone(self, zone=None):
         """ Set the timezone to `zone` """
         # first we remove the current setting
         # we need to create a symlink to /usr/share/zoneinfo
         src = os.path.join(self.timezones_base_dir, zone)
         dest = self.tzlink
-        # This will except
-        return os.symlink(src, dest)
+        # We need to let this except
+        os.symlink(src, dest)
+        return self._activate_zone()
 
 
 class DateTime:

File modules/xfce.py

View file
  • Ignore whitespace
 import gtk
 import sys
 import os
-#if os.getcwd() not in sys.path:
-#    sys.path.append(os.getcwd())
 from support.vectorlinux.utils import _, launch_external_gui
 import subprocess as sp
 import os
 
 VASM_CATEGORY = "%s/%s"% (_("Personal"), _("Graphical Environment"))
 VASM_ICON=os.path.join(os.getcwd(), "modules","support","data", "icons", "xfce.png")
-VASM_LABEL=_("XFCE4 Settings")
+VASM_LABEL=_("XFCE4 Settings")