Changeset 846129d


Ignore:
Timestamp:
02/26/15 07:35:53 (4 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.1.2
Children:
c788b73
Parents:
4cc1a22
Message:

If pc-sysconfig fails to mount a device with the locale-specific option, have it automatically try the locale-agnostic option as well. While here also add a check for cleaning up any stale pipe files which might prevent the daemon from starting up.

Location:
src-sh/pcbsd-utils/pc-sysconfig/daemon
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pcbsd-utils/pc-sysconfig/daemon/Backend-remdev.cpp

    r0ddef2cb r846129d  
    609609  //Now get the mounting commands for the device 
    610610  QStringList cmds = DEVDB::MountCmdsForFS(fs, CLOCALE!="en_US"); 
    611    
     611  bool usedlocale = cmds.join(" ").contains("%3"); 
    612612  //Mount the device 
    613613  bool ok = true; 
     614  bool done = false; 
    614615  QString errline; 
    615616  QString basedir = mntdir.section("/",0,-2); 
    616   for(int i=0; i<cmds.length() && ok; i++){ 
    617     //qDebug() << "Mountpoint:" << mntdir << basedir << mntdir.section("/",-1); 
    618     cmds[i].replace("%1", node).replace("%2a", "\""+basedir+"\"").replace("%2b","\""+mntdir.section("/",-1)+"\"").replace("%2", "\""+mntdir+"\"").replace("%3", CLOCALE); 
    619     if(cmds[i].contains("%4")){ 
    620       cmds[i].replace("%4", runShellCommand("id -u "+CUSER).join("").simplified() );         
    621     } 
    622     if(cmds[i].contains("%5")){ 
    623       cmds[i].replace("%5", runShellCommand("id -g operator").join("").simplified() ); 
    624     } 
    625     ok = ( 0==QProcess::execute(cmds[i]) ); //look for a return code of 0 for success for the command 
    626     if(!ok){ errline = " -- on command: "+cmds[i]; } 
    627   } 
     617  while(!done){ 
     618    for(int i=0; i<cmds.length() && ok; i++){ 
     619      //qDebug() << "Mountpoint:" << mntdir << basedir << mntdir.section("/",-1); 
     620      cmds[i].replace("%1", node).replace("%2a", "\""+basedir+"\"").replace("%2b","\""+mntdir.section("/",-1)+"\"").replace("%2", "\""+mntdir+"\"").replace("%3", CLOCALE); 
     621      if(cmds[i].contains("%4")){ 
     622        cmds[i].replace("%4", runShellCommand("id -u "+CUSER).join("").simplified() );       
     623      } 
     624      if(cmds[i].contains("%5")){ 
     625        cmds[i].replace("%5", runShellCommand("id -g operator").join("").simplified() ); 
     626      } 
     627      ok = ( 0==QProcess::execute(cmds[i]) ); //look for a return code of 0 for success for the command 
     628      if(!ok){ errline = " -- on command: "+cmds[i]; } 
     629    } 
     630    //Check for success and use any fallback methods 
     631    if(!ok && usedlocale){ 
     632      //Failure with custom locale - try it without the localization flags 
     633      ok = true; usedlocale = false; //reset flags for next run 
     634      cmds = DEVDB::MountCmdsForFS(fs, false); 
     635      errline.clear(); 
     636    }else{ 
     637      done = true; 
     638    } 
     639  } //end with "done" loop 
    628640  if( !ok ){ 
    629641    //Error mounting the device 
  • src-sh/pcbsd-utils/pc-sysconfig/daemon/MainDaemon.cpp

    r40572ac1 r846129d  
    1414//General Start/Stop functions 
    1515void MainDaemon::startServer(){ 
     16  //Clean up any stale pipes first 
     17  QLocalServer::removeServer("/var/run/pc-sysconfig.pipe"); 
     18  //Now start this server 
    1619  if( server->listen("/var/run/pc-sysconfig.pipe") ){ 
    1720    QFile::setPermissions("/var/run/pc-sysconfig.pipe", QFile::ReadUser | QFile::WriteUser | QFile::ReadGroup | QFile::WriteGroup | QFile::ReadOther | QFile::WriteOther); 
Note: See TracChangeset for help on using the changeset viewer.