コード例 #1
0
ファイル: ppp.py プロジェクト: ed-aicradle/monotone
    def _start_mgetty(self):
        inittab = InittabManager()
        port = self._get_port_name()
        gname = 'MPX_MGETTY_%s' % port.upper()

        if self.enable:
            loglevel = 0
            if self.debug:
                loglevel = 9
            else:
                # Remove stale mgetty log if not debugging.  No sense using
                # TARGET_ROOT here since mgetty doesn't know anything about it.
                logfile = "/var/log/mgetty.log.%s" % port
                if os.path.isfile(logfile):
                    os.remove(logfile)

            tag = port[-2:]
            if not inittab.findgroup(gname):
                inittab.addgroup(
                    InittabGroup(
                        gname, '%s:2345:respawn:/sbin/mgetty -x %d -n 1 %s' %
                        (tag, loglevel, port)))
        else:
            inittab.remgroup(gname)

        inittab.commit()
コード例 #2
0
ファイル: ppp.py プロジェクト: mcruse/monotone
    def _start_mgetty( self ):
        inittab = InittabManager()
        port = self._get_port_name()
        gname = 'MPX_MGETTY_%s' % port.upper()

        if self.enable:
            loglevel = 0
            if self.debug:
                loglevel = 9
            else:
                # Remove stale mgetty log if not debugging.  No sense using
                # TARGET_ROOT here since mgetty doesn't know anything about it.
                logfile = "/var/log/mgetty.log.%s" % port
                if os.path.isfile( logfile ):
                    os.remove( logfile )

            tag = port[-2:]
            if not inittab.findgroup( gname ):
                inittab.addgroup(
                    InittabGroup(gname,
                                 '%s:2345:respawn:/sbin/mgetty -x %d -n 1 %s'
                                 % (tag, loglevel, port))
                    )
        else:
            inittab.remgroup( gname )

        inittab.commit()
コード例 #3
0
ファイル: direct_ppp.py プロジェクト: mcruse/monotone
 def _start_ppp_program( self ):
     inittab = InittabManager()
     port_name = self._getPortName()
     tag = port_name[-2:]
     gname = 'MPX_MGETTY_%s' % port_name.upper()
     if self.enable:
         if not inittab.findgroup( gname ):
             inittab.addgroup( 
                 InittabGroup( gname, '%s:2345:respawn:/sbin/mgetty -x 0 -n 1 %s' % (tag, port_name) ) )
     else:
         inittab.remgroup( gname )
     inittab.commit()
コード例 #4
0
 def install(self):
     #
     # Note:  Unfortunately the following two import statements have
     #        the side-effect of trying to create a directory under
     #        /var/mpx.  This isn't necessary when just trying to
     #        query this install script and in fact fails in some
     #        cases, so the imports were moved from the top of this
     #        script to here.
     #
     from moab.linux.lib.servicemgr import InittabManager
     from moab.linux.lib.servicemgr import InittabGroup
     
     chown(ROOT, MPX_UID, MPX_GID, recurse=1, ignore_errors=1)
     keywords = {}
     keywords.update(self.keywords)
     keywords.update({'ROOT':DUP_DIR})
     keywords[CommandKeywords.FATAL_KEY] = 1
     # Duplicate the config service so it will work after /usr/lib/broadway
     # is nuked.
     makedirs(DUP_DIR)
     os.system("cp *.pyc %s" % DUP_DIR, **keywords)
     chown(DUP_DIR, MPX_UID, MPX_GID, recurse=1, ignore_errors=1)
     os.system("chmod -R %o %s/*" % (0664, DUP_DIR), **keywords)
     # Create the config_service's custom launcher.
     create_pyscript(CONFIG_SCRIPT, CONFIG_PYC, **keywords)
     # Update inittab to include the new config service.
     inittab = InittabManager(**keywords)
     gname = 'MEDIATOR_CONFIGURATION_SERVICE'
     # Remove any existing mpx_igmp entry.
     for group in inittab.group_list:
         lines = group.text.split('\n')
         found = 0
         for i in range(0, len(lines)):
             line = lines[i]
             if line and line[0] != '#' and line.find('mpx_igmp') != -1:
                 lines[i] = "# %s # - %s" % (line, gname)
                 found = 1
         if found:
             text = lines.pop(0)
             for line in lines:
                 text = "%s\n%s" % (text, line)
             group.text = text
     # Add the Mediator Configuration Service.
     mcs = inittab.findgroup(gname)
     text = 'MCS:2345:respawn:%s' % CONFIG_SCRIPT
     if mcs is None:
         inittab.addgroup(InittabGroup(gname, text))
     else:
         mcs.text = text
     inittab.commit()
     return 0
コード例 #5
0
ファイル: direct_ppp.py プロジェクト: ed-aicradle/monotone
 def _start_ppp_program(self):
     inittab = InittabManager()
     port_name = self._getPortName()
     tag = port_name[-2:]
     gname = 'MPX_MGETTY_%s' % port_name.upper()
     if self.enable:
         if not inittab.findgroup(gname):
             inittab.addgroup(
                 InittabGroup(
                     gname, '%s:2345:respawn:/sbin/mgetty -x 0 -n 1 %s' %
                     (tag, port_name)))
     else:
         inittab.remgroup(gname)
     inittab.commit()