Ticket #918: dependency_boot_sequence.diff

File dependency_boot_sequence.diff, 1.5 KB (added by https://www.google.com/accounts/o8/id?id=AItOawlG5aiZZ6D7CrCtcInFhXmj7TC9AOKTyb8, 12 years ago)
  • DebInit.py

     
    1212    __req__ = {'Service': ['name', 'status']} 
    1313    svcre = re.compile("/etc/.*/(?P<action>[SK])(?P<sequence>\d+)(?P<name>\S+)") 
    1414 
     15    # Debian squeeze and beyond uses a dependecy based boot sequence 
     16    DEBIAN_OLD_STYLE_BOOT_SEQUENCE = ( 
     17            'etch', '4.0', 
     18            'lenny', '5.0', '5.0.1', '5.0.2', '5.0.3', '5.0.4', '5.0.4', '5.0.5', 
     19        ) 
     20 
    1521    # implement entry (Verify|Install) ops 
    1622    def VerifyService(self, entry, _): 
    1723        """Verify Service status for entry.""" 
    1824        rawfiles = glob.glob("/etc/rc*.d/[SK]*%s" % (entry.get('name'))) 
    1925        files = [] 
    20         if entry.get('sequence'): 
    21             start_sequence = int(entry.get('sequence')) 
    22             kill_sequence = 100 - start_sequence 
     26 
     27        try: 
     28            deb_version = open('/etc/debian_version', 'r').read().split('/', 1)[0] 
     29        except IOError: 
     30            deb_version = 'unknown' 
     31 
     32        if entry.get('sequence') 
     33            if (deb_version in DEBIAN_OLD_STYLE_BOOT_SEQUENCE): 
     34                start_sequence = int(entry.get('sequence')) 
     35                kill_sequence = 100 - start_sequence 
     36            else: 
     37                self.logger.warning("Your debian version boot sequence is dependency based \"sequence\" attribute wil be ignored.") 
    2338        else: 
    2439            start_sequence = None 
    2540