Example #1
0
def editFiles(mntDir, name, mac):
    """
    Edit files on image

    @type  mntDir: str
    @param mntDir: mount dir of the VM disk

    @type  name: str
    @param name: vm name

    @type  mac: str
    @param mac: mac address

    @rtype: None
    @returns: Nothing
    """
    # change hostname
    print "Image Editing\n\n"
    
    print "Changing hostname"
    hostname = os.path.join(mntDir, "etc/hostname")
    utils.recordFile(name, hostname)

    # set network as dhcp
    print "Set network as DHCP"
    netconfig = os.path.join(mntDir, "etc/sysconfig/network/ifcfg-eth0")
    content = utils.readFile(netconfig)
    bootproto = re.search("BOOTPROTO=.*",content).group(0)
    if "dhcp" not in bootproto:
        utils.sedFile(bootproto, "BOOTPROTO=dhcp", netconfig)

    # print ip used
    print "IP: " + IP[mac]
    print "root password: 39af21a2ac52f3d5d0df3400c78342b2af80010e0bf3eb5d9e4a9fb931f0ea13904019853568d66d8428265e43e1d237339fda6f9056cc8eca8a582734e3ee8c"
    commom.printSSHPort(mntDir)
Example #2
0
def editFiles(mntDir, name, mac):
    """
    Edit files on image

    @type  mntDir: str
    @param mntDir: mount dir of the VM disk

    @type  name: str
    @param name: vm name

    @type  mac: str
    @param mac: mac address

    @rtype: None
    @returns: Nothing
    """
    # change hostname
    print "Image Editing\n\n"
    
    print "Changing hostname"
    hostname = os.path.join(mntDir, "etc/hostname")
    utils.recordFile(name, hostname)

    # set network as dhcp
    print "Set network as DHCP"
    netconfig = os.path.join(mntDir, "etc/sysconfig/network-scripts/ifcfg-eth0")
    content = utils.readFile(netconfig)
    bootproto = re.search("BOOTPROTO=.*",content).group(0)
    if "dhcp" not in bootproto:
        utils.sedFile(bootproto, "BOOTPROTO=dhcp", netconfig)

    # print ip used
    print "IP: " + IP[mac]
    print "root password: 60fb619414782814d344e9a08d77101ce31057fec58f35643ad167cf67c5e128ea66c750d08282633bb432619c146e0543ae8d61b885902b9f61302b537aaf07"
    commom.printSSHPort(mntDir)   
    def unpack( self ):
      if(not CMakePackageBase.unpack( self ) ):
         return False;
      # rename config.h and glibconfig.h.win32 in glib to
      # avoid config.h confusion
      p = re.compile('.*\.[ch]$')
      sedcmd = r"""-e "s/config.h/config.h.win32/" """
      directory = os.path.join( self.glibDir, "glib" )
      if ( os.path.exists( directory ) ):
          for root, dirs, files in os.walk( directory, topdown=False ):
              print root
              for name in files:
                  if( p.match( name ) ):
                      utils.sedFile( root, name, sedcmd )

      # we have an own cmake script - copy it to the right place
      src = os.path.join( self.packageDir() , "CMakeLists.txt" )
      dst = os.path.join( self.sourceDir() , "CMakeLists.txt" )
      shutil.copy( src, dst )
      src = os.path.join( self.packageDir() , "FindLibintl.cmake" )
      dst = os.path.join( self.sourceDir(), "FindLibintl.cmake" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "FindKDEWin.cmake" )
      dst = os.path.join( self.sourceDir(), "FindKDEWin.cmake" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "CheckMingwVersion.cmake" )
      dst = os.path.join( self.sourceDir(), "CheckMingwVersion.cmake" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "config.h.cmake" )
      dst = os.path.join( self.sourceDir(), "config.h.cmake" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "dirent.c" )
      dst = os.path.join( self.sourceDir(), "dirent.c" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "unistd.c" )
      dst = os.path.join( self.sourceDir(), "unistd.c" )
      shutil.copy( src, dst )

      if not os.path.exists( os.path.join( self.sourceDir(), "headers" ) ):
        os.makedirs( os.path.join( self.sourceDir(), "headers" ) )

      src = os.path.join( self.packageDir(), "dirent.h" )
      dst = os.path.join( self.sourceDir(), "headers", "dirent.h" )
      shutil.copy( src, dst )

      src = os.path.join( self.packageDir() , "unistd.h" )
      dst = os.path.join( self.sourceDir(), "headers", "unistd.h" )
      shutil.copy( src, dst )

      utils.applyPatch( self.glibDir , os.path.join( self.packageDir(), "glib-x64.diff" ), 0 )

      return True
Example #4
0
 def compile( self ):
     cmd = 'cd %s && python configure.py -b %s -w' % ( os.path.join( self.workdir, self.instsrcdir ),
                                                                os.path.join( self.imagedir, "bin" ) )
     if self.compiler == "mingw":
         cmd += " -p win32-g++"
     utils.system( cmd ) or utils.die( "failed to execute %s" % cmd )
     sedcommand = r""" -e "s/""" + os.path.join( self.rootdir, "tmp", "qt" ).replace('\\', '\\/') + "*\\/image-mingw\\/" + """/""" + self.rootdir.replace('\\', '\\/') + """/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "pyqtconfig.py", sedcommand )
     cmd = 'cd %s && %s' % ( os.path.join( self.workdir, self.instsrcdir ), self.cmakeMakeProgramm )
     utils.system( cmd ) or utils.die( "failed to execute %s" % cmd )
     return True
Example #5
0
    def install(self):
        srcdir = os.path.join(self.workdir, os.getenv("KDECOMPILER") + "-" + self.buildType, "wincursors")
        destdir = os.path.join(self.cmakeInstallPrefix, "share", "icons")
        utils.copySrcDirToDestDir(srcdir, destdir)

        srcreg = os.path.join(self.packagedir, "cursor.reg")
        dstreg = os.path.join(self.workdir, "cursor.reg")
        shutil.copy(srcreg, dstreg)

        utils.sedFile(
            self.workdir, "cursor.reg", "s/CHANGEME/%s/g" % destdir.replace("\\", "\\\\\\\\").replace("/", "\\\\\\\\")
        )
        utils.system("regedit /S %s" % os.path.join(self.workdir, "cursor.reg"))
        return True
Example #6
0
def editFiles(mntDir, name, mac):
    """
    Edit files on image

    @type  mntDir: str
    @param mntDir: mount dir of the VM disk

    @type  name: str
    @param name: vm name

    @type  mac: str
    @param mac: mac address

    @rtype: None
    @returns: Nothing
    """
    # change hostname
    print "Image Editing\n\n"
    
    print "Changing hostname"
    hostname = os.path.join(mntDir, "etc/hostname")
    utils.recordFile(name, hostname)

    # set network as dhcp
    print "Set network as static"
    netconfig = os.path.join(mntDir, "etc/network/interfaces")
    fd = open(netconfig, "a")
    fd.write("\n" + INTERFACES_CONFIG % {"ip":IP[mac]})
    fd.close()

    # allow password authentication on ssh
    utils.sedFile("without-password", "yes", os.path.join(mntDir, "etc/ssh/sshd_config"))

    # print ip used
    print "IP: " + IP[mac]
    print "root password: 60fb619414782814d344e9a08d77101ce31057fec58f35643ad167cf67c5e128ea66c750d08282633bb432619c146e0543ae8d61b885902b9f61302b537aaf07"
    commom.printSSHPort(mntDir)
Example #7
0
 def unpack( self ):
     ok = base.baseclass.unpack( self )
     # remove query for acceptance of GPL
     sedcommand = r""" -e "s/resp = raw_input(\"Do you accept the terms of the license? \")/resp = \"yes\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     # instead of using qt.conf fix it in the sources here.
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::PrefixPath)/\"""" + self.rootdir.replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::HeadersPath)/\"""" + os.path.join( self.rootdir, "include" ).replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::LibrariesPath)/\"""" + os.path.join( self.rootdir, "lib" ).replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::BinariesPath)/\"""" + os.path.join( self.rootdir, "bin" ).replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::DataPath)/\"""" + self.rootdir.replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     sedcommand = r""" -e "s/QLibraryInfo::location(QLibraryInfo::PluginsPath)/\"""" + os.path.join( self.rootdir, "plugins" ).replace('\\', '\\\\\\\\\\\\\\\\') + """\\"/g" """
     utils.sedFile( os.path.join( self.workdir, self.instsrcdir ), "configure.py", sedcommand )
     return ok