Пример #1
0
void ExportNative::runScript()
{
    QString tempDir = getTempDirectory();
    QString logDir = tempDir + "logs";
    QString configDir = tempDir + "config";
    QString commandline;

    // remove existing progress.log if present
    if (QFile::exists(logDir + "/progress.log"))
        QFile::remove(logDir + "/progress.log");

    // remove cancel flag file if present
    if (QFile::exists(logDir + "/mythburncancel.lck"))
        QFile::remove(logDir + "/mythburncancel.lck");

    createConfigFile(configDir + "/mydata.xml");
    commandline = "mytharchivehelper -n " + configDir + "/mydata.xml";  // job file
    commandline += " > "  + logDir + "/progress.log 2>&1 &";            // Logs

    int state = system(qPrintable(commandline));

    if (state != 0)
    {
        ShowOkPopup(QObject::tr("It was not possible to create the DVD. "
                                "An error occured when running the scripts") );
    }
    else
    {
        showLogViewer();
    }
}
Пример #2
0
void ExportNative::runScript()
{
    QString tempDir = getTempDirectory();
    QString logDir = tempDir + "logs";
    QString configDir = tempDir + "config";
    QString commandline;

    // remove existing progress.log if present
    if (QFile::exists(logDir + "/progress.log"))
        QFile::remove(logDir + "/progress.log");

    // remove cancel flag file if present
    if (QFile::exists(logDir + "/mythburncancel.lck"))
        QFile::remove(logDir + "/mythburncancel.lck");

    createConfigFile(configDir + "/mydata.xml");
    commandline = "mytharchivehelper --nativearchive --outfile " + configDir + 
                  "/mydata.xml";  // job file
    commandline += logPropagateArgs;
    if (!logPropagateQuiet())
        commandline += " --quiet";
    commandline += " > "  + logDir + "/progress.log 2>&1 &";            // Logs

    uint flags = kMSRunBackground | kMSDontBlockInputDevs | 
                 kMSDontDisableDrawing;
    uint retval = myth_system(commandline, flags);
    if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
    {
        ShowOkPopup(QObject::tr("It was not possible to create the DVD. "
                                "An error occured when running the scripts") );
        return;
    }

    showLogViewer();
}
Пример #3
0
bool ConfigXML::createXML()
{
    CnMn = moduleConf->getCompanyName()
            + "_" + moduleConf->getModuleName();
    bool res1 = createDeclFile();
    bool res2 = createConfigFile();
    return res1 && res2;
}
Пример #4
0
/**
 * Generates a configuration file to be used in testing.
 * @param MCGPU_path The path to MCGPU's root directory.
 * @param fileName The name of the configuration file to generate.
 * @param primaryAtomIndexString The entry for the Primary Atom Index line of
 *   the config file.
 */
void createT3pDimConfigFile(std::string MCGPU, std::string fileName,
                            std::string primaryAtomIndexString) {
  ConfigFileData settings = ConfigFileData(
      26.15, 26.15, 26.15, 298.15, .12, 100000, 256,
      "resources/bossFiles/oplsaa.par",
      "test/unittests/MultipleSolvents/t3pdimTests/t3pdim.z",
      "test/unittests/MultipleSolvents/t3pdimTests",
      11.0, 12.0, 12345);
  createConfigFile(MCGPU, fileName, primaryAtomIndexString, settings);
}
Пример #5
0
void Dialog::okClicked()
{
  long pidNumber; 
  
  if ((0 < (pidNumber = verifyPidFile())) && !verifyFields())
  {
    createConfigFile();
    sendSignal((pid_t) pidNumber);
  }
}
Пример #6
0
void ImportFile::OKPressed()
{
    QString configFile = getTempDirectory() + "config/importjob.xml";

    createConfigFile(configFile);

    QString commandline;
    QString tempDir = gCoreContext->GetSetting("MythArchiveTempDir", "");

    if (tempDir == "")
        return;

    if (!tempDir.endsWith("/"))
        tempDir += "/";

    QString logDir = tempDir + "logs";

    // remove any existing logs
    myth_system("rm -f " + logDir + "/*.log");

    commandline = "mytharchivehelper -v none,jobqueue --logpath " + logDir + " --importfile "
                  "--infile \"" + configFile + "\"";
    uint flags = kMSRunBackground | kMSDontBlockInputDevs |
                 kMSDontDisableDrawing;
    uint retval = myth_system(commandline, flags);
    if (retval != GENERIC_EXIT_RUNNING && retval != GENERIC_EXIT_OK)
    {
        ShowOkPopup(tr("It was not possible to import the file. "
                       " An error occured when running 'mytharchivehelper'") );
        return;
    }

    showLogViewer();

    Close();
}
Пример #7
0
/**
 * Generates a configuration file to be used in testing.
 * @param MCGPU_path The path to MCGPU's root directory.
 * @param fileName The name of the configuration file to generate.
 * @param primaryAtomIndexString The entry for the Primary Atom Index line of the config file.
 */
void createIndoleConfigFile(std::string MCGPU, std::string fileName, std::string primaryAtomIndexString) {
  ConfigFileData settings = ConfigFileData(35.36, 35.36, 35.36, 298.15, .12, 40000, 267, "resources/bossFiles/oplsaa.par", 
  "test/unittests/Integration/IndoleTest/indole.z", "test/unittests/Integration/IndoleTest", 12.0, 
  12.0, 12345);
  createConfigFile(MCGPU, fileName, primaryAtomIndexString, settings);
}
Пример #8
0
// procédure pour "activer" le device, en l'occurence : mettre les paramètres de base qui nous intéressent nous :
static void ZytActivateDevice(int fd)
{
  int fdConf,val;
  char param[100],res[10];

  //paramètres par défaut : (également utilisés pour créer le fichier de configuration par la suite, s'il n'existe pas)
  zytConf.dimDalleX = 1024;
  zytConf.dimDalleY = 768;
  zytConf.seuil = 10;
  zytConf.epaisseur = 1;
  zytConf.attenteMultiClic = 300;
  // par défaut on ne garde que le premier appui d'une série : la "souris" ne bougera pas entre un appui et un relachement
  zytConf.mode=NO_DRAG_DROP;
  zytConf.frameRateAveraging=3;
  zytConf.nbClignToPress=5; // le nombre d'appuis successifs pour comprendre un appui après un clignotement
  zytConf.debug=NO_DEBUG;

  // récupération des paramètres choisis, et création du fichier si besoin :
  fdConf = open(ZYT_CONF_FILE,O_RDWR);
  if(fdConf==-1){
    D_INFO("ZYT, le fichier %s de configuration de la dalle zytronic n'existe pas, creation en cours...\n",ZYT_CONF_FILE);
    createConfigFile(&fdConf);
    D_INFO("ZYT, ...creation de %s finie.\n",ZYT_CONF_FILE);
  }else{
    D_INFO("ZYT, le fichier %s de configuration de la dalle zytronic existe.\n",ZYT_CONF_FILE);
  }

  // puis, on charge les valeurs de configuration, en gardant les valeurs par défaut pour les paramètres non précisés :
  lseek(fdConf,0,SEEK_SET); // on retourne au début du fichier (au cas où on vient de le créé)
  while(nextConf(fdConf,param,res)!=ZYT_END_OF_CONF_FILE){
    val = atoi(res);
    D_INFO("parametre : %s = %d\n",param,val); //debug
    if(strcmp(param,ZYT_CONF_DIM_DALLE_X)==0){
      zytConf.dimDalleX=val;
    }else if(strcmp(param,ZYT_CONF_DIM_DALLE_Y)==0){
      zytConf.dimDalleY=val;
    }else if(strcmp(param,ZYT_CONF_SEUIL)==0){
      zytConf.seuil=val;
    }else if(strcmp(param,ZYT_CONF_EPAISSEUR)==0){
      zytConf.epaisseur=val;
    }else if(strcmp(param,ZYT_CONF_ATTENTE_MULTI_CLIC)==0){
      zytConf.attenteMultiClic=val*1000; //on passe les millisecondes en microsecondes
    }else if(strcmp(param,ZYT_CONF_MODE)==0){
      zytConf.mode=val;
    }else if(strcmp(param,ZYT_CONF_FRAME_AVERAGING)==0){
      zytConf.frameRateAveraging=val;
    }else if(strcmp(param,ZYT_CONF_NB_CLIGN_TO_PRESS)==0){
      zytConf.nbClignToPress=val;
    }else if(strcmp(param,ZYT_CONF_DEBUG)==0){
      zytConf.debug=val;
    }else {
      D_INFO("ZYT, parametre non reconnu : %s\n",param);
      D_INFO("ZYT, veuillez verifier le  fichier de configuration %s!\n",ZYT_CONF_FILE);
    }
  }
  close(fdConf);

  // envoi des paramètres du controleur pour utilisation normale :
  //packet[0]=ZYT_INIT_FW_RESET; // permet de "mieux" initialiser le controleur, utile? (long : ~5sec)
  //ZytSendPacket(fd,packet,1); // attention, commande inutilisable telle qu'elle, car elle coupe la liaison
     // et donc empêche les commandes suivantes...
     // (ici en l'occurence tout le paramètrage qui suit...) !!!
  packet[0]=ZYT_RESTORE_FACTORY_DEFAULT_SETTINGS;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_SET_FRAME_AVERAGING + zytConf.frameRateAveraging;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_DISABLE_CONTINUOUS_RAW_SENSOR_DATA;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_SET_TOUCH_THRESHOLD + zytConf.seuil;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_SET_GLASS_THICKNESS + zytConf.epaisseur;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_ENABLE_CONTROLLER;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_FORCE_EQUALISATION;
  ZytSendPacket(fd,packet,1);
  packet[0]=ZYT_XY_TOUCH_MESSAGE_MODE;
  ZytSendPacket(fd,packet,1);
}
Пример #9
0
bool DTSettings::load()
{
    delete mSettings;
    createConfigFile();
    return true;
}
Пример #10
0
int Awstats::prepareAwstatsEnv( const HttpVHost * pVHost )
{
    uid_t uid = HttpGlobals::s_uid;
    gid_t gid = HttpGlobals::s_gid;
    struct stat st;
    char achBuf[1024];
    
    if ( pVHost->getRootContext().getSetUidMode() == UID_DOCROOT )
    {
        uid = pVHost->getUid();
        gid = pVHost->getGid();
    }
    
    // create working directory if need
    if ( nio_stat( m_sWorkingDir.c_str(), &st ) == -1 )
    {
        if ( mkdir( m_sWorkingDir.c_str(), 0755 ) == -1 )
        {
            LOG_ERR(( "Can not create awstats working directory[%s]: %s",
                m_sWorkingDir.c_str(), strerror( errno ) ));
            return -1;
            
        }
    }
    chown( m_sWorkingDir.c_str(), uid, gid );
    if ( m_iMode == AWS_STATIC )
    {
        safe_snprintf( achBuf, 1024, "%s/html", m_sWorkingDir.c_str() );
        if ( nio_stat( achBuf, &st ) == -1 )
        {
            if ( mkdir( achBuf, 0755 ) == -1 )
            {
                LOG_ERR(( "Can not create awstats working directory[%s]: %s",
                    achBuf, strerror( errno ) ));
                return -1;
            }
        }
        chown( achBuf, uid, gid );
    }
    // create data directory if need
    safe_snprintf( achBuf, 1024, "%s/data", m_sWorkingDir.c_str() );
    mkdir( achBuf, 0755 );
    chown( achBuf, uid, gid );
    // create conf directory if need
    safe_snprintf( achBuf, 1024, "%s/conf", m_sWorkingDir.c_str() );
    mkdir( achBuf, 0755 );
    chown( achBuf, uid, gid );
    // copy awstats.model.conf to conf/ directory if does not exist
    safe_snprintf( achBuf, 1024, "%s/conf/awstats.model.conf", m_sWorkingDir.c_str() );
    if ( nio_stat( achBuf, &st ) == -1 )
    {
        char achTmp[1024];
        const char * pChroot = "";
        if (HttpGlobals::s_psChroot)
            pChroot = HttpGlobals::s_psChroot->c_str();
        
        safe_snprintf( achTmp, 1024, "%s%s/add-ons/awstats/wwwroot/cgi-bin/awstats.model.conf",
                  pChroot, HttpGlobals::s_pServerRoot);
        if ( copyFile( achTmp, achBuf ) )
        {
            return -1;
        }
        chown( achBuf, uid, gid );
    }

    if ( createConfigFile( achBuf, pVHost ) == -1 )
        return -1;
    chown( achBuf, uid, gid );
    return 0;        
}
Пример #11
0
int Awstats::prepareAwstatsEnv(const HttpVHost *pVHost)
{
    ServerProcessConfig &procConfig = ServerProcessConfig::getInstance();
    uid_t uid = procConfig.getUid();
    gid_t gid = procConfig.getGid();
    struct stat st;
    char achBuf[1024];

    if (pVHost->getRootContext().getSetUidMode() == UID_DOCROOT)
    {
        uid = pVHost->getUid();
        gid = pVHost->getGid();
    }

    // create working directory if need
    if (ls_fio_stat(m_sWorkingDir.c_str(), &st) == -1)
    {
        if (mkdir(m_sWorkingDir.c_str(), 0755) == -1)
        {
            LS_ERROR("Can not create awstats working directory[%s]: %s",
                     m_sWorkingDir.c_str(), strerror(errno));
            return LS_FAIL;

        }
    }
    chown(m_sWorkingDir.c_str(), uid, gid);
    if (m_iMode == AWS_STATIC)
    {
        ls_snprintf(achBuf, 1024, "%s/html", m_sWorkingDir.c_str());
        if (ls_fio_stat(achBuf, &st) == -1)
        {
            if (mkdir(achBuf, 0755) == -1)
            {
                LS_ERROR("Can not create awstats working directory[%s]: %s",
                         achBuf, strerror(errno));
                return LS_FAIL;
            }
        }
        chown(achBuf, uid, gid);
    }
    // create data directory if need
    ls_snprintf(achBuf, 1024, "%s/data", m_sWorkingDir.c_str());
    mkdir(achBuf, 0755);
    chown(achBuf, uid, gid);
    // create conf directory if need
    ls_snprintf(achBuf, 1024, "%s/conf", m_sWorkingDir.c_str());
    mkdir(achBuf, 0755);
    chown(achBuf, uid, gid);
    // copy awstats.model.conf to conf/ directory if does not exist
    ls_snprintf(achBuf, 1024, "%s/conf/awstats.model.conf",
                m_sWorkingDir.c_str());
    if (ls_fio_stat(achBuf, &st) == -1)
    {
        char achTmp[1024];
        const char *pChroot = "";
        if (procConfig.getChroot() != NULL)
            pChroot = procConfig.getChroot()->c_str();

        ls_snprintf(achTmp, 1024,
                    "%s%s/add-ons/awstats/wwwroot/cgi-bin/awstats.model.conf",
                    pChroot, MainServerConfig::getInstance().getServerRoot());
        if (copyFile(achTmp, achBuf))
            return LS_FAIL;
        chown(achBuf, uid, gid);
    }

    if (createConfigFile(achBuf, pVHost) == -1)
        return LS_FAIL;
    chown(achBuf, uid, gid);
    return 0;
}