Changeset 77c0221


Ignore:
Timestamp:
09/18/13 09:21:39 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
4d597a9
Parents:
b64e501 (diff), b26c1ac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/rapenne-c/pcbsd

Files:
3 added
18 edited

Legend:

Unmodified
Added
Removed
  • overlays/install-overlay/usr/share/pc-sysinstall/conf/avail-langs

    r261f12e rb26c1ac  
    1919et Eesti Keel 
    2020fi Suomi 
    21 fr Le français 
     21fr Français 
    2222fr_CA Français canadien 
    2323fur Furlan 
  • src-sh/pc-sysinstall/conf/avail-langs

    r261f12e rb26c1ac  
    1919et Eesti Keel 
    2020fi Suomi 
    21 fr Le français 
     21fr Français 
    2222fr_CA Français canadien 
    2323fur Furlan 
  • overlays/install-overlay/root/beadm.install

    rfa1fd42 raad2985  
    2727unset LANG 
    2828PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin 
    29  
    30 if [ $( uname -r | cut -c 1 ) -lt 8 ] 
    31 then 
    32   echo "ERROR: beadm works on FreeBSD 8.0 or later" 
    33   exit 1 
    34 fi 
    3529 
    3630__usage() { 
  • src-qt4/life-preserver/LPTray.cpp

    rf698804 re9760d0  
    33//PUBLIC 
    44LPTray::LPTray() : QSystemTrayIcon(){ 
    5   initPhase = true; //flag that we are in the startup process 
    65  //Start up the log file watcher and connect the signals/slots 
    76  watcher = new LPWatcher(); 
    87        connect(watcher,SIGNAL(MessageAvailable(QString)),this,SLOT(watcherMessage(QString)) ); 
    9          
    10   /*QString logfile = "/var/log/lpreserver/lpreserver.log"; 
    11   watcher = new QFileSystemWatcher(); 
    12         if(!QFile::exists(logfile)){  
    13           if(!QFile::exists("/var/log/lpreserver")){ system( "mkdir /var/log/lpreserver"); } 
    14           system( QString("touch "+logfile).toUtf8() );  
    15         } 
    16         watcher->addPath(logfile); 
    17   logFile = new QFile(logfile); 
    18         logFile->open(QIODevice::ReadOnly | QIODevice::Text); //open it now, for faster reading 
    19   LFStream = new QTextStream(logFile); 
    20         connect(watcher, SIGNAL(fileChanged(QString)),this,SLOT(slotNewLogMessage(QString)) ); //now connect the signal/slot 
    21         */ 
     8        connect(watcher,SIGNAL(StatusUpdated()),this,SLOT(watcherMessage()) ); 
    229  //Setup the context menu 
    2310  menu = new QMenu; 
     
    2512        connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(slotClose()) ); 
    2613  this->setContextMenu(menu); 
    27   //Setup the animated icon timer 
    28   /* 
    29   timer = new QTimer(); 
    30         timer->setInterval(100); 
    31         connect(timer, SIGNAL(timeout()), this, SLOT(displayWorkingIcon()) ); 
    32   */ 
    3314  //Setup initial icon for the tray 
    3415  this->setIcon( QIcon(":/images/tray-icon-idle.png") ); 
     
    3718  //connect other signals/slots 
    3819  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)) ); 
    39   //Make sure we check the latest line in the logfile 
    40   //QTimer::singleShot(1000, this,SLOT(firstCheck())); 
    4120  //Start up the watcher 
    4221  watcher->start(); 
     
    4625 
    4726LPTray::~LPTray(){ 
    48   //if(statFile != 0){ statFile->close(); } 
    49   //logFile->close(); 
    50   //delete statFile; 
    51   //delete logFile; 
    5227  watcher->stop(); 
    5328  delete watcher; 
    54   //delete menu; 
    55   //delete timer; 
    5629} 
    5730 
     
    5932//  PRIVATE FUNCTIONS 
    6033// =============== 
    61 /* 
    62 void LPTray::parseLogMessage(QString log, bool quiet){ 
    63   //Divide up the log into it's sections 
    64   QString timestamp = log.section(":",0,2).simplified(); 
    65   QString time = timestamp.section(" ",3,3).simplified(); 
    66   QString message = log.section(":",3,3).toLower().simplified(); 
    67   QString dev = log.section(":",4,4).simplified(); //dataset/snapshot/nothing 
    68   //Now decide what to do/show because of the log message 
    69   qDebug() << "New Log Message:" << log; 
    70   if(message.contains("creating snapshot")){ 
    71     dev = message.section(" ",-1).simplified(); 
    72     if(!quiet){ this->showMessage( time, QString(tr("Creating snapshot for %1")).arg(dev), QSystemTrayIcon::Information, 5000); } 
    73     //Just set the standard idle icon 
    74     this->setIcon( QIcon(":/images/tray-icon-idle.png") );    
    75     setIdleToolTip(); 
    76   }else if(message.contains("starting replication")){ 
    77     startWorkingIcon(); 
    78     //Setup the file watcher for this new log file 
    79     sFile = dev; 
    80     if(!sFile.isEmpty()){ 
    81       if(!QFile::exists(sFile)){ system( QString("touch "+sFile).toUtf8() ); } 
    82       statFile = new QFile(sFile); 
    83         statFile->open(QIODevice::ReadOnly | QIODevice::Text); 
    84         SFStream = new QTextStream(statFile); 
    85       watcher->addPath(sFile); //will update/set tooltips 
    86     } 
    87   }else if(message.contains("finished replication")){ 
    88     stopWorkingIcon(); 
    89     //Stop the file wather from watching the status file and clean up 
    90     if(!sFile.isEmpty()){ 
    91       watcher->removePath(sFile); 
    92           statFile->close(); 
    93           sFile.clear(); 
    94     } 
    95     //Clean up and show messages 
    96     repTotK.clear(); 
    97     setIdleToolTip(); 
    98     dev = message.section(" ",-1).simplified(); 
    99     if(!quiet){ this->showMessage( time, QString(tr("Finished replication for %1")).arg(dev), QSystemTrayIcon::Information, 5000); } 
    100   }else if( message.contains("FAILED replication") ){ 
    101     stopWorkingIcon(); 
    102     //Stop the file wather from watching the status file and clean up 
    103     if(!sFile.isEmpty()){ 
    104       watcher->removePath(sFile); 
    105           statFile->close(); 
    106           sFile.clear(); 
    107     } 
    108     //Clean up and show messages 
    109     repTotK.clear(); 
    110     dev = message.section(" ",-1).simplified(); 
    111     QString file = log.section("LOGFILE:",1,1).simplified(); 
    112     QString tt = QString(tr("%1: Replication Failed on %2")).arg(time,dev) +"\n"+ QString(tr("Logfile available at: %1")).arg(file); 
    113     this->setToolTip(tt);    
    114     if(!quiet){ this->showMessage( time, QString(tr("Replication Error for %1")).arg(dev), QSystemTrayIcon::Information, 5000); } 
    115     this->setIcon(QIcon(":/images/tray-icon-failed.png")); 
    116   }else{ 
    117     //Just set the standard idle icon 
    118     //this->setIcon( QIcon(":/images/tray-icon-idle.png") );     
    119   } 
    120   if(GUI->isVisible()){ 
    121     GUI->setupUI(); 
    122   } 
    123 } 
    124  
    125 void LPTray::parseStatusMessage(QString stat){ 
    126   qDebug() << "New Status Message:" << stat; 
    127   //Divide up the status message into sections 
    128   stat.replace("\t"," "); 
    129   QString dataset = stat.section(" ",2,2,QString::SectionSkipEmpty).section("/",0,0).simplified(); 
    130   QString cSize = stat.section(" ",1,1,QString::SectionSkipEmpty); 
    131   //Now Setup the tooltip 
    132   if(cSize != lastSize){ //don't update the tooltip if the same size info 
    133     QString percent; 
    134     if(!repTotK.isEmpty()){ 
    135       //calculate the percentage 
    136       double tot = displayToDoubleK(repTotK); 
    137       double c = displayToDoubleK(cSize); 
    138       if( tot!=-1 & c!=-1){ 
    139         double p = (c*100)/tot; 
    140         p = int(p*10)/10.0; //round to 1 decimel places 
    141         percent = QString::number(p) + "%"; 
    142       } 
    143     } 
    144     if(repTotK.isEmpty()){ repTotK = "??"; } 
    145     //Format the tooltip String 
    146     QString status = cSize+"/"+repTotK; 
    147     if(!percent.isEmpty()){ status.append(" ("+percent+")"); } 
    148     QString txt = QString(tr("Replicating %1: %2")).arg(dataset, status); 
    149     this->setToolTip(txt); 
    150     lastSize = cSize; //save the current size for later 
    151   } 
    152 } 
    153  
    154 void LPTray::setIdleToolTip(){ 
    155   //Get the last snapshot created 
    156   QStringList dsList = LPBackend::listDatasets(); 
    157   if(dsList.isEmpty()){ 
    158     this->setToolTip(tr("Automatic Snapshots Disabled")); 
    159   }else{ 
    160     //Grab the newest snapshot from each dataset 
    161     QString tt; //tooltip 
    162     for(int i=0; i<dsList.length(); i++){ 
    163       QStringList snaps = LPBackend::listLPSnapshots(dsList[0]); 
    164       if(!tt.isEmpty()){ tt.append("\n"); } //put each dataset on a new line 
    165       if(snaps.isEmpty()){ 
    166         tt.append( QString(tr("%1: No snapshots available")).arg(dsList[0]) ); 
    167       }else{ 
    168         tt.append( QString(tr("%1: Latest snapshot: %2")).arg(dsList[0],snaps[0]) ); 
    169       } 
    170     } 
    171     this->setToolTip(tt); 
    172   } 
    173          
    174 } 
    175  
    176 void LPTray::startWorkingIcon(){ 
    177   this->setIcon( QIcon(":/images/tray-icon-active7.png")); 
    178   //wNum = 1; //start on the first image 
    179   //timer->start(); 
    180 } 
    181  
    182 void LPTray::stopWorkingIcon(){ 
    183   //timer->stop(); 
    184   this->setIcon( QIcon(":/images/tray-icon-idle.png") );       
    185 } 
    186  
    187 double LPTray::displayToDoubleK(QString displayNumber){ 
    188   QStringList labels;  
    189     labels << "K" << "M" << "G" << "T" << "P" << "E"; 
    190   QString clab = displayNumber.right(1); //last character is the size label 
    191         displayNumber.chop(1); //remove the label from the number 
    192   double num = displayNumber.toDouble(); 
    193   //Now format the number properly 
    194   bool ok = false; 
    195   for(int i=0; i<labels.length(); i++){ 
    196     if(labels[i] == clab){ ok = true; break; } 
    197     else{ num = num*1024; } //get ready for the next size 
    198   } 
    199   if(!ok){ num = -1; } //could not determine the size 
    200   return num; 
    201 } 
    202 */ 
    203  
    20434void LPTray::updateTrayIcon(){ 
    20535  if( watcher->hasError() ){ 
     
    24979     
    25080  }else if(type=="critical"){ 
    251            
     81    info << "time" << "message" << "device"; 
     82    info = watcher->getMessages(type,info); 
     83    if(!info.isEmpty()){ 
     84      QString msg = QString(tr("Time: %1")).arg(info[0]); 
     85      //message/device information can have more than one listed 
     86      QStringList devs = info[2].split(":::");       
     87      QStringList msgs = info[1].split(":::"); 
     88      for(int i=0; i<devs.length(); i++){ 
     89        msg.append("\n"+QString(tr("%1: %2")).arg(devs[i],msgs[i]) ); 
     90      } 
     91      QString title = tr("System Alert"); 
     92      QMessageBox::warning(0, title ,msg); 
     93    } 
    25294  }else if(type=="mirror"){ 
    25395           
     96  }else if(type=="scrub" || type =="resilver"){ 
     97    info << "id" << "time" << "message"; 
     98    info = watcher->getMessages(type, info); 
     99    if(!info.isEmpty()){ 
     100      if(info[0]=="ERROR"){  
     101        this->showMessage(info[1], info[2], QSystemTrayIcon::Warning, 5000); 
     102      }else{  
     103        this->showMessage(info[1], info[2], QSystemTrayIcon::Information, 5000);  
     104      } 
     105    } 
    254106  } 
    255107  //Update the tray icon 
     
    258110  updateToolTip(); 
    259111} 
    260 /* 
    261 void LPTray::firstCheck(){ 
    262   slotNewLogMessage("/var/log/lpreserver/lpreserver.log"); 
    263   initPhase = false; //done with initializations 
    264 } 
    265112 
    266 void LPTray::slotNewLogMessage(QString file){ 
    267   //qDebug() << "New Log Message in file:" << file; 
    268   if(file == "/var/log/lpreserver/lpreserver.log"){ 
    269     //Backend Status Update 
    270     //Now parse the log lines and do stuff with it 
    271     while( !LFStream->atEnd() ){ parseLogMessage(LFStream->readLine(), initPhase); } 
    272   }else{ 
    273     //Replication status update 
    274       //get the last line from the file 
    275       QString stat; 
    276       while( !SFStream->atEnd() ){  
    277         QString line = SFStream->readLine();  
    278         if(line.contains("total estimated size")){ repTotK = line.section(" ",-1).simplified(); } //save the total size to replicate 
    279         else if(line.startsWith("send from ")){} 
    280         else if(line.startsWith("TIME ")){} 
    281         else{ stat = line; } //only save the relevant status line 
    282       } 
    283       //parse the status line 
    284       if(!stat.isEmpty()){ parseStatusMessage(stat); } 
    285   } 
    286 } 
    287 */ 
    288113void LPTray::slotTrayClicked(QSystemTrayIcon::ActivationReason reason){ 
    289114  if(reason == QSystemTrayIcon::Trigger){  
     
    314139    GUI->show(); 
    315140} 
    316  
    317 /*void LPTray::displayWorkingIcon(){ 
    318   QString ico = ":/images/tray-icon-active"+QString::number(wNum)+".png"; 
    319   this->setIcon(QIcon(ico)); 
    320   if(wNum == 16){ wNum = 1; } //go back to the beginning of the loop 
    321   else{ wNum++; } 
    322 }*/ 
  • src-qt4/life-preserver/LPTray.h

    rf698804 re9760d0  
    44#include <QSystemTrayIcon> 
    55#include <QMenu> 
    6 #include <QFileSystemWatcher> 
    76#include <QString> 
    8 #include <QTimer> 
    9 #include <QProcess> 
    10 #include <QFile> 
    11 #include <QTextStream> 
     7#include <QMessageBox> 
    128 
    139#include "mainUI.h" 
     
    2117 
    2218private: 
    23         //QFileSystemWatcher *watcher; 
    2419        LPWatcher *watcher; 
    2520        QMenu *menu; 
    26         //QTimer *timer; 
    2721        mainUI *GUI; 
    28         //QString sFile; //location of the replication status file 
    29         //QFile *logFile, *statFile; 
    30         //QTextStream *LFStream, *SFStream; 
    31         //QString repTotK, lastSize; 
    32         //int wNum; //internal tracking of which frame of the icon animation we are on 
    33         bool initPhase; 
    3422 
    35         //void parseLogMessage(QString, bool quiet = false); 
    36         //void parseStatusMessage(QString); 
    37         //void setIdleToolTip(); 
    38         //void startWorkingIcon(); 
    39         //void stopWorkingIcon(); 
    40         //double displayToDoubleK(QString); 
    4123 
    4224        void updateTrayIcon(); 
     
    4426         
    4527private slots: 
    46         void watcherMessage(QString); 
    47         //void firstCheck(); 
    48         //void slotNewLogMessage(QString); 
     28        void watcherMessage(QString type = ""); 
     29 
    4930        void slotTrayClicked(QSystemTrayIcon::ActivationReason); 
    5031        void slotClose(); 
    5132        void slotSingleInstance(); 
    5233        void startGUI(); 
    53         //void displayWorkingIcon(); 
     34 
    5435}; 
    5536 
  • src-qt4/life-preserver/LPWatcher.cpp

    r23f66b8 r04144d6  
    77    "critical" status: 30-39 
    88    "mirror" status: 40-49 
    9     "resilvering" status: 50-59 
     9    "resilver" status: 50-59 
    1010    "scrub" status: 60-69 
    1111  Within each set: 
    1212    *0 = ID Code (for internal identification as necessary) 
    13     *1 = dataset (example: tank1) 
     13    *1 = zpool (example: tank1) 
    1414    *2 = summary (shortened version of the message - tooltips) 
    1515    *3 = message (full message) 
     
    3131  FILE_ERROR="/var/log/lpreserver/error.log"; 
    3232  FILE_REPLICATION=""; //this is set automatically based on the log file outputs 
    33  
     33  sysCheckTime = 300000; // 5 minutes 
    3434  //initialize the watcher and timer 
    3535  watcher = new QFileSystemWatcher(this); 
    3636    connect(watcher, SIGNAL(fileChanged(QString)),this,SLOT(fileChanged(QString)) ); 
    3737  timer = new QTimer(); 
    38     timer->setInterval( 300000 ); //5 minute check time 
    3938    connect(timer, SIGNAL(timeout()), this, SLOT(checkPoolStatus()) ); 
    4039  //initialize the log file reader 
     
    7170  checkPoolStatus(); 
    7271  //And start up the error file watcher 
    73   timer->start(); 
     72  if(!timer->isActive()){ timer->start(sysCheckTime); } 
    7473} 
    7574 
     
    9089  else if(type=="critical"){base=30;} 
    9190  else if(type=="mirror"){base=40;} 
    92   else if(type=="resilvering"){base=50;} 
     91  else if(type=="resilver"){base=50;} 
    9392  else if(type=="scrub"){base=60;} 
    9493  else{ return output; } //invalid input type 
     
    9796    msgList[i] = msgList[i].toLower(); 
    9897    if(msgList[i]=="id" && LOGS.contains(base)){ output << LOGS[base]; } 
    99     else if(msgList[i]=="dataset" && LOGS.contains(base+1)){ output << LOGS[base+1]; } 
     98    else if(msgList[i]=="device" && LOGS.contains(base+1)){ output << LOGS[base+1]; } 
    10099    else if(msgList[i]=="summary" && LOGS.contains(base+2)){ output << LOGS[base+2]; } 
    101100    else if(msgList[i]=="message" && LOGS.contains(base+3)){ output << LOGS[base+3]; } 
     
    288287    //parse the output 
    289288    QString pool, state, timestamp; 
    290     qDebug() << "-----zpool status------"; 
    291     bool newresilver = false; 
     289    QStringList cDev, cStat, cMsg, cSummary; 
     290    //qDebug() << "-----zpool status------"; 
     291    bool newresilver = false; bool newscrub = false; bool newerror = false; 
    292292    for(int i=0; i<zstat.length(); i++){ 
    293293      zstat[i] = zstat[i].simplified(); 
    294294      if(zstat[i].isEmpty()){ continue; } 
    295       qDebug() << zstat[i]; 
     295      //qDebug() << zstat[i]; 
    296296      if(zstat[i].startsWith("pool:")){ pool = zstat[i].section(":",1,10).simplified(); } 
    297297      else if(zstat[i].startsWith("state:")){ state = zstat[i].section(":",1,10).simplified(); } 
    298298      else if(zstat[i].startsWith("scan:")){ 
    299299        //check for scrubs/resilvering progress 
    300         bool isnew = false; 
    301300        // ------ SCRUB ------ 
    302301        if(zstat[i].contains("scrub")){ 
    303           //Setup the latest/running scrub info 
    304302          if(zstat[i].contains(" scrub repaired ")){ 
     303            //Scrub Finished 
    305304            zstat[i]  = zstat[i].replace("\t"," ").simplified(); 
    306305            timestamp = zstat[i].section(" ",10,14,QString::SectionSkipEmpty); 
     
    310309            //Scrub finished previously 
    311310            if(numFixed.toInt() > 0){  
    312               if(LOGS.value(60)!="ERROR"){ isnew=true; } 
     311              if(LOGS.value(60)!="ERROR"){ newscrub=true; } 
    313312              LOGS.insert(60, "ERROR");  
    314313              LOGS.insert(62, QString(tr("Scrub repaired %1 bad blocks")).arg(numFixed) ); 
    315314              LOGS.insert(63, QString(tr("Scrub repaired %1 blocks in %2 with %3 errors")).arg(numFixed, timeRun, numErr) ); 
    316315            }else{  
    317               if(LOGS.value(60)!= " " && LOGS.value(60)!="FINISHED"){ isnew=true; } 
     316              if(LOGS.contains(60) && LOGS.value(60)!="FINISHED"){ newscrub=true; } 
    318317              LOGS.insert(60,"FINISHED");  
    319318              LOGS.insert(62, tr("Scrub completed") ); 
     
    323322            LOGS.insert(64, timestamp); 
    324323            LOGS.insert(65, timestamp.section(" ",3,3) ); 
     324            if(timer->interval() != sysCheckTime){ timer->start(sysCheckTime); } 
    325325          }else{ 
    326326            //Scrub is running - parse the line 
    327             timestamp = "??"; 
    328             QString percent = "??"; 
    329             QString remain = "??"; 
    330             if(LOGS.value(60) != "RUNNING"){isnew=true;} 
     327            timestamp = zstat[i].section(" ",5,9,QString::SectionSkipEmpty); 
     328            i++; QString remain = zstat[i].section(" ",7,7,QString::SectionSkipEmpty); 
     329            i++; QString percent = zstat[i].section(" ",2,2,QString::SectionSkipEmpty); 
     330            if(LOGS.value(60) != "RUNNING"){newscrub=true;} 
    331331            LOGS.insert(60,"RUNNING"); 
    332332            LOGS.insert(61,pool); 
    333             LOGS.insert(62, QString(tr("Scrubbing: %1 (%2 remaining)")).arg(percent, remain) ); 
    334             LOGS.insert(63, QString(tr("Scrubbing: %1 (%2 remaining)")).arg(percent, remain) ); 
     333            LOGS.insert(62, QString(tr("Scrubbing %1: %2 (%3 remaining)")).arg(pool, percent, remain) ); 
     334            LOGS.insert(63, QString(tr("Scrubbing %1: %2 (%3 remaining)")).arg(pool, percent, remain) ); 
    335335            LOGS.insert(64, timestamp); 
    336336            LOGS.insert(65, timestamp.section(" ",3,3) ); 
    337             qDebug() << "***Running Scrub: line needs parsing"; 
     337            if(timer->interval() != 60000){ timer->start(60000); } //put the timer on a 1 minute refresh since it is running 
    338338          } 
    339           if(isnew){ emit MessageAvailable("scrub"); } 
    340339          if(LOGS.contains(50) ){ 
    341340            //Only resilvering OR scrub is shown at a time - so remove the resilver info 
     
    372371            LOGS.remove(65); 
    373372          } 
     373          if(timer->interval() != 60000){ timer->start(60000); }//put the timer on a 1 minute refresh since it is running 
    374374        }else if(zstat[i].contains("resilvered")){ 
    375375          //Resilvering is finished 
     
    378378          QString errors = zstat[i].section(" ", 6,6,QString::SectionSkipEmpty); 
    379379          //Setup the running re-silvering progress 
    380           if(LOGS.value(50)!= " "){newresilver=true; } //don't display message for first run 
     380          if(LOGS.contains(50)){newresilver=true; } //don't display message for first run 
    381381          if(errors.toInt() > 0){  
    382382            LOGS.insert(50, "ERROR"); 
     
    400400            LOGS.remove(65); 
    401401          } 
     402          if(timer->interval() != sysCheckTime){ timer->start(sysCheckTime); } 
    402403        } 
    403404      }else if(zstat[i].startsWith("errors:")){ 
     
    407408      }else if( state != "ONLINE" || !LOGS.value(50).isEmpty() ){ 
    408409        //Check for state/resilvering of all real devices 
    409         if(zstat[i].contains("NAME\tSTATE\tREAD")){continue;} //nothing on this header line 
    410         else if(zstat[i].contains("(resilvering)")){ LOGS.insert(51, zstat[i].section("\t",0,0,QString::SectionSkipEmpty) ); } 
     410        QString msg, summary, status; 
     411        QString device = zstat[i].section(" ",0,0,QString::SectionSkipEmpty); 
     412        if(zstat[i].contains("NAME STATE READ")){continue;} //nothing on this header line 
     413        else if(zstat[i].contains("(resilvering)")){ LOGS.insert(51, device ); continue;} 
    411414        else if(zstat[i].contains("ONLINE")){continue;} //do nothing for this device - it is good 
    412         else if(zstat[i].contains("OFFLINE")){ } 
    413         else if(zstat[i].contains("DEGRADED")){ } 
    414         else if(zstat[i].contains("FAULTED")){ } 
    415         else if(zstat[i].contains("REMOVED")){ } 
    416         else if(zstat[i].contains("UNAVAIL")){ } 
     415        else if(zstat[i].contains("OFFLINE")){ continue; } //do nothing - this status must be set manually - it is not a "random" status 
     416        else if(zstat[i].contains("DEGRADED")){  
     417          cStat << "DEGRADED"; 
     418          cMsg << tr("The device is in a degraded state, and should be replaced soon."); 
     419          cSummary << QString(tr("%1 is degraded.")).arg(device); 
     420          cDev << device; 
     421        }else if(zstat[i].contains("FAULTED")){  
     422          cStat << "FAULTED"; 
     423          cMsg << tr("The device is faulty, and should be replaced."); 
     424          cSummary << QString(tr("%1 is faulty.")).arg(device); 
     425          cDev << device; 
     426        }else if(zstat[i].contains("REMOVED")){  
     427          cStat << "REMOVED"; 
     428          cMsg << tr("The device was removed, and should be either be re-attached or replaced."); 
     429          cSummary << QString(tr("%1 was removed.")).arg(device); 
     430          cDev << device; 
     431        }else if(zstat[i].contains("UNAVAIL")){  
     432          cStat << "UNAVAILABLE"; 
     433          cMsg << tr("The device is unavailable and should be re-added to the pool."); 
     434          cSummary << QString(tr("%1 is unavailable.")).arg(device); 
     435          cDev << device; 
     436        } 
    417437      } 
    418438    } //end of loop over zpool status lines 
    419   if(newresilver){ emit MessageAvailable("resilvering"); } 
    420 } 
     439     
     440  //Add the critical messages to the hash 
     441  if(cStat.isEmpty()){ 
     442    if(LOGS.contains(30)){ 
     443      LOGS.remove(30); 
     444      LOGS.remove(31); 
     445      LOGS.remove(32); 
     446      LOGS.remove(33); 
     447      LOGS.remove(34); 
     448      LOGS.remove(35); 
     449    } 
     450  }else{ 
     451    if(LOGS.value(30) != cStat.join(":::") ){ newerror = true; } 
     452    LOGS.insert(30, cStat.join(":::") ); 
     453    LOGS.insert(31, cDev.join(":::") ); 
     454    LOGS.insert(32, cSummary.join(":::") ); 
     455    LOGS.insert(33, cMsg.join(":::") ); 
     456    LOGS.insert(34, timestamp); 
     457    LOGS.insert(35, timestamp.section(" ",3,3) ); 
     458  } 
     459     
     460  //Now emit the appropriate signal 
     461  if(newerror){ emit MessageAvailable("critical"); } 
     462  else if(newresilver){ emit MessageAvailable("resilver"); } 
     463  else if(newscrub){ emit MessageAvailable("scrub"); } 
     464  else{ emit StatusUpdated(); } 
     465} 
  • src-qt4/life-preserver/LPWatcher.h

    rb5a7675c r220bbd4  
    3737        QFileSystemWatcher *watcher; 
    3838        QTimer *timer; 
     39        int sysCheckTime; 
    3940        QFile *logfile, *repfile; 
    4041        QTextStream *LFSTREAM, *RFSTREAM; 
     
    5657signals: 
    5758        void MessageAvailable(QString type); 
     59        void StatusUpdated(); 
    5860}; 
    5961 
  • src-qt4/warden-gui/dialogEditIP.ui

    red41975 rdd3cf11  
    271271           <widget class="QLabel" name="label"> 
    272272            <property name="text"> 
    273              <string>The following permissions can be enabled or diabled for this jail. For more details hover over each item or refer to the jail manpage.</string> 
     273             <string>The following permissions can be enabled or disabled for this jail. For more details hover over each item or refer to the jail manpage.</string> 
    274274            </property> 
    275275            <property name="wordWrap"> 
  • src-sh/pbi-manager10/pbi-manager

    r651bd28 r52c32d9  
    6868  --keep <num> -- Keep <num> old versions in archive folder for each built PBI 
    6969  --prune      -- Remove files from 'outdir' that no longer have a module 
    70   --pkgcache   -- Create and use a .txz pkg cache directory, in the <outdir> of each PBI 
     70  --pkgbuild   -- Build the PBIs using packages from PKGNG 
    7171  --tmpfs      -- Use TMPFS for port WRKDIRPREFIX 
    7272  --sign key   -- Sign the PBI(s) with specified openssl key 
     
    128128  --meta file  -- Include the specified meta file in the PBI header 
    129129  --mkdebug    -- Drop to debug shell if port make fails 
     130  --pkgbuild   -- Build PBI from PKGNG package repo 
    130131  --tmpfs      -- Use TMPFS for port WRKDIRPREFIX 
    131132  --no-prune   -- Do not prune non REQUIREDBY ports 
    132   --pkgdir dir -- Enable .txz pkg caching in the following directory 
    133133  --sign key   -- Sign the PBI with specified openssl key 
    134134 
     
    10211021        --genpatch)     PBI_AB_GENPATCH="YES"  
    10221022                        ;; 
    1023         --pkgcache)     PBI_AB_PKGCACHE="YES"  
     1023        --pkgbuild)     PBI_AB_PKGBUILD="YES"  
    10241024                        ;; 
    10251025            --keep)     if [ $# -eq 1 ]; then usage_autob_pbi; fi 
     
    11731173                --mkdebug)      MKDEBUG="YES" 
    11741174                        ;; 
     1175                --pkgbuild)     PBI_PKGNGBUILD="YES" 
     1176                        ;; 
    11751177                --tmpfs)        MKTMPFS="YES" 
    11761178                        ;; 
     
    11961198                        if [ -n "${PBI_MAKEPREFIX}" ]; then usage_make_pbi; fi 
    11971199                        shift; PBI_MAKEPREFIX="$1" 
    1198                         ;; 
    1199             --pkgdir)   if [ $# -eq 1 ]; then usage_make_pbi; fi 
    1200                         shift 
    1201                         get_abspath "$1" 
    1202                         PBI_PKGCACHEDIR="$_ABSPATH" 
    1203                         PBI_PKGCACHE="YES" 
    12041200                        ;; 
    12051201            --sign)     if [ $# -eq 1 ]; then usage_make_pbi; fi 
     
    12221218                if [ -n "${PBI_CREATE_OUTDIR}" ] ; then PBI_CREATE_OUTDIR="/pbiout" ; fi 
    12231219                if [ -n "${PORTSDIR}" ] ; then PORTSDIR="/usr/ports" ; fi 
    1224         else 
    1225         # If running as pbi_makeport 
    1226  
    1227                 # Make sure the PBI_PKGCACHEDIR exists 
    1228                 if [ -n "${PBI_PKGCACHEDIR}" -a ! -d "${PBI_PKGCACHEDIR}" ] ; then 
    1229                         exit_err "No such directory: ${PBI_PKGCACHEDIR}" 
    1230                 fi 
    12311220        fi 
    12321221 
     
    13621351        PBI_XDGICONDIR="${PBI_APPDIR}/share/icons/hicolor" 
    13631352        PBI_XDGMIMEDIR="${PBI_APPDIR}/share/mime/packages" 
    1364         PBI_RCDIR="${SYS_LOCALBASE}/etc/rc.d" 
     1353        PBI_RCDIR="${PBI_APPDIR}/etc/rc.d" 
    13651354        PBI_ETCCONF="${SYS_LOCALBASE}/etc/pbi.conf" 
    13661355        PCBSD_ETCCONF="${SYS_LOCALBASE}/etc/pcbsd.conf" 
     
    15311520detect_pkgng() 
    15321521{ 
    1533         export PORTSDIR 
    1534         # Are we using pkgng? 
    1535         WITH_PKGNG=$(make -f ${PORTSDIR}/Mk/bsd.port.mk -V WITH_PKGNG) 
    1536         if [ -n "${WITH_PKGNG}" ]; then 
    1537                 export PKGNG=1 
    1538                 export PKG_ADD="pkg add" 
    1539                 export PKG_DELETE="pkg delete -y -f" 
    1540         else 
    1541                 export PKGNG=0 
    1542                 export PKG_ADD=pkg_add 
    1543                 export PKG_DELETE=pkg_delete 
    1544         fi 
    1545  
     1522        export PKG_ADD="pkg add" 
     1523        export PKG_DELETE="pkg delete -y -f" 
    15461524} 
    15471525 
     
    15961574                if [ -n "${PBI_PROGVERSION}" ] ; then return 0 ; fi 
    15971575        else 
     1576                # Check first if we have this pkg in PKGNG 
     1577                if [ -e "/usr/local/sbin/pkg-static" ] ; then 
     1578                        local testPkgVer="`pkg info -O ${PBI_MAKEPORT} | awk '{print $1}' | rev | cut -d '-' -f 1 | rev`" 
     1579                        if [ -n "$testPkgVer" ] ; then 
     1580                                export PBI_PROGVERSION="$testPkgVer" 
     1581                                return 0 
     1582                        fi 
     1583                fi 
     1584 
    15981585                return 0 
    15991586        fi 
    16001587 
     1588        # Get the version from ports 
    16011589        if [ -z "${PBI_PROGVERSION}" -a -n "${PORTSDIR}" -a -n "${PBI_MAKEPORT}" ] ; then 
    16021590                PORTVER="`make -C ${PORTSDIR}/${PBI_MAKEPORT} -V DISTVERSION PORTSDIR=${PORTSDIR} 2>/dev/null`" 
     
    17161704set_make_options() { 
    17171705 
    1718         # Set the LOCALBASE 
    1719         LOCALBASE="${PBI_PROGDIRPATH}" 
    1720         if [ -e "${LOCALBASE}" ] ; then  
    1721                 if [ "$MKDELBUILD" != "YES" ] ; then 
    1722                         exit_err "${LOCALBASE} already exists! Delete it before doing a rebuild" 
    1723                 else 
    1724                         if [ -z "${LOCALBASE}" ] ; then 
    1725                                 exit_err "null LOCALBASE, this shouldn't happen" 
    1726                         fi 
    1727                         rm -rf "${LOCALBASE}" 
    1728                 fi 
    1729         fi 
    1730  
    17311706        local MAKE_CONF="/etc/make.conf" 
    17321707 
    1733         echo "LOCALBASE=${LOCALBASE}" >> ${MAKE_CONF} 
    17341708        echo "PACKAGE_BUILDING=yes" >> ${MAKE_CONF} 
    17351709        echo "BATCH=yes" >> ${MAKE_CONF} 
    17361710        echo "NO_IGNORE=yes" >> ${MAKE_CONF} 
    17371711        echo "PACKAGE_BUILDING=yes" >> ${MAKE_CONF} 
     1712        echo "WITH_PKGNG=yes" >> ${MAKE_CONF} 
    17381713 
    17391714        echo "WRKDIRPREFIX=/usr/wrkdirprefix" >> ${MAKE_CONF} 
     
    17451720        fi 
    17461721 
    1747         # Link LOCALBASE -> /usr/local 
    1748         mkdir -p ${LOCALBASE} 
    1749         rm -rf /usr/local 
    1750         ln -s ${LOCALBASE} /usr/local 
     1722        if [ ! -d "/usr/local" ] ; then 
     1723                mkdir -p /usr/local 
     1724        fi  
    17511725 
    17521726        # Make sure ldconfig is primed 
    17531727        /etc/rc.d/ldconfig start 
     1728 
     1729        if [ "$PBI_PKGNGBUILD" ] ; then 
     1730                echo "Installing pkgng..." 
     1731                pkgFetchURL=`grep "^packagesite:" /usr/local/etc/pkg.conf | awk '{print $2}'` 
     1732                cd /tmp 
     1733                fetch -o pkg.txz ${pkgFetchURL}/Latest/pkg.txz 
     1734                if [ $? -ne 0 ] ; then exit_err "Failed fetching pkgng..."; fi 
     1735                tar xvf pkg.txz >/dev/null 2>/dev/null 
     1736                ./usr/local/sbin/pkg-static add pkg.txz 
     1737                if [ $? -ne 0 ] ; then exit_err "Failed installing pkgng..."; fi 
     1738                rm pkg.txz 
     1739        else 
     1740                echo "Building pkgng..." 
     1741                cd /usr/ports/ports-mgmt/pkg 
     1742                make install clean 
     1743                if [ $? -ne 0 ] ; then exit_err "Failed building pkgng!" ; fi  
     1744        fi 
    17541745 
    17551746        # Check if using ccache directory 
     
    17601751                if [ $? -eq 0 ] ; then 
    17611752                        # Setup environment variables 
    1762                         CCACHE_PATH="/usr/bin:${LOCALBASE}/bin" 
     1753                        CCACHE_PATH="/usr/bin:/usr/local/bin" 
    17631754                        export CCACHE_PATH 
    17641755                        CCACHE_DIR="/.ccache" 
    17651756                        export CCACHE_DIR 
    1766                         PATH="${LOCALBASE}/libexec/ccache:${PATH}" 
     1757                        PATH="/usr/local/libexec/ccache:${PATH}" 
    17671758                        export PATH 
    17681759 
    17691760                        # Setup make configuration 
    17701761                        echo ".if !defined(NO_CCACHE)" >> ${MAKE_CONF} 
    1771                         echo "  CC=${LOCALBASE}/libexec/ccache/world/cc" >> ${MAKE_CONF} 
    1772                         echo "  CXX=${LOCALBASE}/libexec/ccache/world/c++" >> ${MAKE_CONF} 
     1762                        echo "  CC=/usr/local/libexec/ccache/world/cc" >> ${MAKE_CONF} 
     1763                        echo "  CXX=/usr/local/libexec/ccache/world/c++" >> ${MAKE_CONF} 
    17731764                        echo ".endif" >> ${MAKE_CONF} 
    17741765                else 
     
    17771768        fi 
    17781769 
    1779         PATH="${PATH}:/usr/local/bin:/usr/local/sbin:${LOCALBASE}/bin:${LOCALBASE}/sbin" 
     1770        PATH="${PATH}:/usr/local/bin:/usr/local/sbin" 
    17801771        export PATH 
    17811772 
     
    35613552 
    35623553        if [ "`basename $0`" = "pbi_makeport" -o "`basename $0`" = "pbi_makeport_chroot" ] ; then 
    3563           PBI_STAGEDIR="${PBI_PROGDIRPATH}" 
     3554          PBI_STAGEDIR="/usr/local" 
    35643555        else 
    35653556          mk_stage_dir 
     
    49484939start_pbi_makeport() 
    49494940{ 
    4950         do_port_build "/usr/ports/${PBI_MAKEPORT}" 
     4941        do_port_build "${PBI_MAKEPORT}" 
    49514942} 
    49524943 
     
    49584949        local iFile="$PORTSDIR/INDEX-$FBSDMAJOR" 
    49594950 
    4960         get_pkgname "${PORTSDIR}/${PBI_MAKEPORT}" 
     4951        get_pkgname "${PBI_MAKEPORT}" 
    49614952        echo "${PKGNAME}" > /.keepports 
    49624953        grep "^${PKGNAME}|" $iFile | cut -d '|' -f 9 | tr ' ' '\n' >>/.keepports 
     
    49664957        do 
    49674958                if [ ! -d "${PORTSDIR}/${port}" ] ; then continue ; fi 
    4968                 get_pkgname "${PORTSDIR}/${port}" 
     4959                get_pkgname "${port}" 
    49694960                echo "${PKGNAME}" >> /.keepports 
    49704961                grep "^${PKGNAME}|" $iFile | cut -d '|' -f 9 | tr ' ' '\n' >>/.keepports 
     
    49744965        do 
    49754966                if [ ! -d "${PORTSDIR}/${port}" ] ; then continue ; fi 
    4976                 get_pkgname "${PORTSDIR}/${port}" 
     4967                get_pkgname "${port}" 
    49774968                echo "${PKGNAME}" >> /.keepports 
    49784969                grep "^${PKGNAME}|" $iFile | cut -d '|' -f 9 | tr ' ' '\n' >>/.keepports 
    49794970        done 
     4971 
     4972        # Don't strip out pkgng 
     4973        pkg info pkg >> /.keepports 
    49804974         
    49814975        # Sort and clean the ports 
     
    49834977        mv /.keepports.tmp /.keepports 
    49844978 
    4985         # Define some commands 
    4986         if [ $PKGNG -eq 1 ] ; then 
    4987                 pkgInf="pkg info -f" 
    4988         else 
    4989                 pkgInf="pkg_info -I -a" 
    4990         fi 
    4991  
    49924979        # Now remove any unused ports 
    4993         for j in `$pkgInf | cut -d " " -f 1` 
     4980        for j in `pkg info -a | cut -d " " -f 1` 
    49944981        do 
    49954982                grep -q "^${j}" "/.keepports" 
     
    50034990# Get the full package-name for a target port 
    50044991get_pkgname() { 
    5005         name="`make -C ${1} -V PKGNAME PORTSDIR=${PORTSDIR}`" 
     4992        name="`pkg info -O ${1} | awk '{print $1}'`" 
    50064993        PKGNAME="${name}" 
    50074994} 
     
    50175004                        exit_err "/usr/ports/${port} does not exist!" 
    50185005                fi 
    5019                 do_port_build "/usr/ports/${port}" 
     5006                do_port_build "${port}" 
    50205007        done 
    50215008 
     
    50325019                        exit_err "/usr/ports/${port} does not exist!" 
    50335020                fi 
    5034                 do_port_build "/usr/ports/${port}" 
     5021                do_port_build "${port}" 
    50355022        done 
    50365023 
     
    59975984        fi 
    59985985 
    5999         # Check if we need to enable pkgcaching 
    6000         if [ "$PBI_AB_PKGCACHE" = "YES" -a -z "$PBI_AB_NOPKGCACHE"  ] ; then 
    6001                 if [ ! -d "${_od}/pkgcache" ] ; then 
    6002                         mkdir -p ${_od}/pkgcache 
    6003                 fi 
    6004                 _flags="${_flags} --pkgdir ${_od}/pkgcache" 
     5986        # Check if we need to enable pkgbuilding 
     5987        if [ "$PBI_AB_PKGBUILD" = "YES" -a -z "$PBI_AB_NOPKGBUILD"  ] ; then 
     5988                _flags="${_flags} --pkgbuild" 
    60055989        fi 
    60065990 
     
    67106694        start_pbi_mkportafter 
    67116695 
     6696        # Get the version again, in case we installed from pkgng and it doesn't match ports 
     6697        get_pbi_progversion 
     6698 
    67126699        # Prune any proto / build specific ports 
    67136700        start_pbi_prune_ports 
     
    69036890        cp ${PBI_WRAPPERFILE} ${PBI_CHROOTDIR}/.pbiwrapper-$ARCH 
    69046891 
     6892        if [ "$PBI_PKGNGBUILD" = "YES" ] ; then 
     6893                mkdir -p ${PBI_CHROOTDIR}/usr/local/etc 2>/dev/null 
     6894                cp /usr/local/etc/pkg.conf ${PBI_CHROOTDIR}/usr/local/etc/pkg.conf 
     6895                local pubKey=`cat /usr/local/etc/pkg.conf | grep "^PUBKEY:" | awk '{print $2}'` 
     6896                if [ -n "$pubKey" ] ; then 
     6897                        if [ ! -d "${PBI_CHROOTDIR}/`dirname $pubKey`" ] ; then 
     6898                                mkdir "${PBI_CHROOTDIR}/`dirname $pubKey`" 
     6899                        fi 
     6900                        cp $pubKey ${PBI_CHROOTDIR}/$pubKey 
     6901                fi 
     6902        fi 
     6903 
    69056904        # If we have a custom PBI_MAKECONF include it 
    69066905        [ -e "${PBI_MAKECONF}" ] && cp ${PBI_MAKECONF} ${PBI_CHROOTDIR}/etc/make.conf 
     
    69246923        mount_nullfs ${PORTSDIR} ${PBI_CHROOTDIR}/usr/ports 
    69256924 
    6926         # Are we doing pkg caching? 
    6927         if [ "$PBI_PKGCACHE" = "YES" ] ; then 
    6928                 mkdir ${PBI_CHROOTDIR}/pkgs 
    6929                 mount_nullfs ${PBI_PKGCACHEDIR} ${PBI_CHROOTDIR}/pkgs 
    6930         fi 
    6931          
    69326925        # Now copy over the pbi_* scripts 
    69336926        mkdir ${PBI_CHROOTDIR}/usr/local/sbin 2>/dev/null 
     
    72127205mk_auto_ext_linksfile() { 
    72137206        # Get ports name 
    7214         get_pkgname "${PORTSDIR}/${PBI_MAKEPORT}" 
     7207        get_pkgname "${PBI_MAKEPORT}" 
    72157208        _pname="${PKGNAME}" 
    72167209 
    7217         # Define some commands 
    7218         if [ $PKGNG -eq 1 ] ; then 
    7219                 pkgInf="pkg info -l" 
    7220         else 
    7221                 pkgInf="pkg_info -L" 
    7222         fi 
    7223  
    7224         ${pkgInf} ${_pname} | sed "s|^${PBI_PROGDIRPATH}/||g" \ 
     7210        pkg info -l ${_pname} | sed "s|^${PBI_PROGDIRPATH}/||g" \ 
    72257211                | grep -v -e "^Information for" -e "^Files:" -e "owns the following" \ 
    72267212                | tr -s '\t' ' ' \ 
     
    73457331do_port_build() 
    73467332{ 
    7347   local _lPort="$1" 
     7333  local _lPortRaw="$1" 
     7334  local _lPort="/usr/ports/$1" 
    73487335 
    73497336  local iFile="$PORTSDIR/INDEX-$FBSDMAJOR" 
     
    73577344  # Make sure this port isn't already loaded 
    73587345  local pkgName=`make -V PKGNAME -C $_lPort PORTSDIR=${PORTSDIR}` 
    7359   if [ $PKGNG -eq 1 ] ; then 
    7360         pkg info -e ${pkgName} 
    7361         if [ $? -eq 0 ] ; then return ; fi 
    7362   else 
    7363         if [ -e "/var/db/pkg/${pkgName}" ] ; then return ; fi 
    7364   fi 
     7346  pkg info -e ${pkgName} 
     7347  if [ $? -eq 0 ] ; then return ; fi 
    73657348 
    73667349  # Save any users / groups we need to create later 
     
    73807363 
    73817364    # is this installed? 
    7382     if [ $PKGNG -eq 1 ] ; then 
    7383         pkg info -e ${cPkg} 
    7384         if [ $? -eq 0 ] ; then continue ; fi 
    7385     else 
    7386         if [ -e "/var/db/pkg/${cPkg}" ] ; then continue ; fi 
    7387     fi 
     7365    pkg info -e ${cPkg} 
     7366    if [ $? -eq 0 ] ; then continue ; fi 
    73887367 
    73897368    local _port=`grep "^${cPkg}|" $iFile | cut -d '|' -f 2` 
     
    73937372  done 
    73947373 
    7395   if [ $PKGNG -eq 1 ] ; then 
    7396         pkgInf="pkg info -e" 
    7397         pkgDep="pkg info -d" 
    7398         pkgCreate="pkg create -f txz" 
    7399   else 
    7400         pkgInf="pkg_info" 
    7401         pkgDep="pkg_info -r" 
    7402         pkgCreate="pkg_create -J -b" 
     7374  # Are we doing a PKGNG build? 
     7375  if [ "$PBI_PKGNGBUILD" ] ; then 
     7376        pkg install -y "$_lPortRaw" 
     7377        if [ $? -ne 0 ] ; then 
     7378           exit_err "Failed installing $_lPortRaw" 
     7379        fi 
     7380        return 0 
    74037381  fi 
    74047382 
    7405   # Not installed, see if we have a pkg to install instead 
    7406   if [ -e "/pkgs/${pkgName}.txz" ] ; then 
    7407      REBUILDPKG="NO" 
    7408      echo "Checking package: ${pkgName}" 
    7409      $pkgDep /pkgs/${pkgName}.txz | grep -v -e "^Information" -e "depends on:" -e "^Depends" | sed '/^$/d' | sed 's|Dependency: ||g' > /tmp/deps.$$ 
    7410      while read dLine 
    7411      do 
    7412         $pkgInf $dLine >/dev/null 2>/dev/null 
    7413         if [ $? -ne 0 ] ; then 
    7414            echo "Package dependencies updated! Rebuilding port..." 
    7415            REBUILDPKG="YES" 
    7416            break 
    7417         fi 
    7418      done < /tmp/deps.$$ 
    7419      rm /tmp/deps.$$ 
    7420  
    7421      # Fix some pkgs bugging us with license questions 
    7422      PACKAGE_BUILDING=yes 
    7423      export PACKAGE_BUILDING 
    7424  
    7425      if [ "$REBUILDPKG" = "NO" ] ; then 
    7426        echo "Adding package: ${pkgName}" 
    7427        $PKG_ADD -f /pkgs/${pkgName}.txz 
    7428        return 
    7429      fi 
    7430   fi 
    7431  
    7432   # No package, lets do old-fashioned build 
     7383  # Lets do old-fashioned build 
    74337384  echo "Compiling port: ${_lPort}" 
    74347385  cd ${_lPort} 
     
    74517402  make clean 
    74527403 
    7453   # Are we caching packages? 
    7454   if [ "${PBI_PKGCACHE}" = "YES" ] ; then 
    7455  
    7456     # Prune outdated versions of cached pkg 
    7457     local basePkgName 
    7458     basePkgName="`echo ${pkgName} | rev | cut -d '-' -f 2- | rev`" 
    7459     for rmPkg in `ls /pkgs/${basePkgName}* 2>/dev/null | sed 's|/pkgs/||g'` 
    7460     do 
    7461         testPkg="`echo ${rmPkg} | rev | cut -d '-' -f 2- | rev`" 
    7462         if [ -n "$testPkg" -a "$testPkg" = "$basePkgName" ] ; then 
    7463            echo "Pruning old cache pkg: ${rmPkg}" 
    7464            rm /pkgs/${rmPkg} 
    7465         fi 
    7466     done 
    7467  
    7468     # Create new pkg 
    7469     ${pkgCreate} ${pkgName} 
    7470     if [ $? -ne 0 ] ; then 
    7471        exit_err "$pkgCreate ${pkgName} failed!" 
    7472     fi 
    7473     mv ${pkgName}.txz /pkgs/ 
    7474     sha256 -q /pkgs/${pkgName}.txz >/pkgs/${pkgName}.txz.sha256 
    7475   fi 
    74767404}; 
    74777405 
  • src-sh/pbi-manager10/wrapper/Makefile

    r651bd28 r6144235  
    127127        -@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/pbi || $(MKDIR) $(INSTALL_ROOT)/usr/pbi/ 
    128128        -$(INSTALL_FILE) .pbiwrapper $(INSTALL_ROOT)/usr/pbi/.pbiwrapper 
     129        -$(INSTALL_FILE) ldconfig $(INSTALL_ROOT)/usr/pbi/.ldconfig 
    129130 
    130131install:   FORCE install_scripts 
  • src-sh/warden/bin/warden

    rf4066f6 re5240d6  
    6262        start - Start a jail 
    6363         stop - Stops a jail 
    64          type - Set the jail type (pbibox|pluginjail|portjail|standard) 
     64         type - Set the jail type (pluginjail|portjail|standard) 
    6565     template - Manage jail templates 
    6666    zfsmksnap - Create a ZFS snapshot of a jail  
     
    376376Lets you set the type of jail to these options: 
    377377 
    378 pbibox: Special container for PBIs using host IP & user directories 
    379378portjail: Jail with access to your home directories and Xorg 
    380379pluginjail: Jail that can be used to install FreeNAS plugins 
     
    476475 
    477476Available Flags: 
    478   -a           (List all jails, including pbi containers) 
    479477  -v           (Verbose listing) 
    480478 
     
    637635  --vanilla                    (Don't install PC-BSD pkgng repo and utilities) 
    638636  --startauto                  (Start this jail at system boot) 
    639   --pbibox                     (Make this a pbi container) 
    640637  --portjail                   (Make this a portjail) 
    641638  --pluginjail                 (Make this a pluginjail) 
     
    655652" 
    656653}; 
    657  
    658654 
    659655# Fix old style meta-data, can be removed after 9.1 
     
    879875 
    880876         case $TYPE in 
    881            pbibox) 
    882               rm ${JMETADIR}/jail-pluginjail > /dev/null 2>/dev/null 
    883               rm ${JMETADIR}/jail-portjail >/dev/null 2>/dev/null 
    884               mkpbibox "${JAILDIR}" 
    885               ;; 
    886877           portjail) 
    887878              rm ${JMETADIR}/jail-pluginjail > /dev/null 2>/dev/null 
     
    11821173             --vanilla) VANILLA="YES" ;; 
    11831174             --portjail) JAILTYPE="portjail" ;; 
    1184              --pbibox) JAILTYPE="pbibox" ;; 
    11851175             --pluginjail) JAILTYPE="pluginjail" ; VANILLA="YES" ;;  
    11861176             --linuxjail) JAILTYPE="linuxjail" ; shift 
     
    12891279esac 
    12901280 
     1281 
    12911282exit 0 
  • src-sh/warden/conf/warden.conf

    r1620346 re5240d6  
    1111# Location of the jails 
    1212JDIR: /usr/jails 
    13  
    14 # FreeBSD release to use 
    15 FREEBSD_RELEASE: 9.1-RELEASE 
  • src-sh/warden/scripts/backend/createjail.sh

    rf4066f6 re5240d6  
    8181 
    8282case "${JAILTYPE}" in 
    83   pbibox) PBIBOX="YES" ;; 
    8483  linuxjail) LINUXJAIL="YES" ;; 
    8584  pluginjail) PLUGINJAIL="YES" ;; 
     
    9190# If using a ARCHIVEFILE we can skip this step 
    9291if [ -z "$TEMPLATE" -a -z "$ARCHIVEFILE" ] ; then 
     92  which uname 
     93  uname -r 
    9394  DEFTEMPLATE="`uname -r | cut -d '-' -f 1-2`-${ARCH}" 
     95  echo "DEF: $DEFTEMPLATE" 
    9496 
    9597  # If on a plugin jail, lets change the nickname 
     
    333335echo "PCBSD_METAPKGSET: warden" > ${JAILDIR}/usr/local/etc/pcbsd.conf 
    334336 
    335 # Check if making a PBI box 
    336 if [ "$PBIBOX" = "YES" ] ; then mkpbibox "${JAILDIR}" ; fi 
    337  
    338337# Check if making a portjail 
    339338if [ "$PORTJAIL" = "YES" ] ; then mkportjail "${JAILDIR}" ; fi 
  • src-sh/warden/scripts/backend/functions.sh

    r29f8f9d re5240d6  
    4848export WARDENVER 
    4949 
    50 # Dirs to nullfs mount in X jail / pbibox 
     50# Dirs to nullfs mount in X jail 
    5151NULLFS_MOUNTS="/tmp /media" 
    5252X11_MOUNTS="/usr/local/lib/X11/icons /usr/local/lib/X11/fonts /usr/local/etc/fonts" 
     
    183183} 
    184184 
    185 # Mount all the FS needed for a PBI container 
    186 mountpbibox() { 
     185### Mount all needed filesystems for the jail 
     186mountjailxfs() { 
     187 
     188  if [ ! -d "${JDIR}/${1}/" ] ; then 
     189     exit_err "Invalid jail directory: ${JDIR}/${1}" 
     190  fi 
    187191 
    188192  # Update the user files on the portjail 
     
    257261    mount_nullfs ${i} ${JDIR}/${1}${i} 
    258262  done 
    259  
    260   # If this is a portjail, we can stop now 
    261   if [ "$1" = "portjail" ] ; then return ; fi 
    262  
    263   # For PBIs lets mount a few extra things 
    264   for nullfs_mount in ${X11_MOUNTS}; do 
    265     if [ ! -d "${JDIR}/${1}${nullfs_mount}" ] ; then 
    266         continue 
    267     fi 
    268     if is_symlinked_mountpoint ${nullfs_mount}; then 
    269       echo "${nullfs_mount} has symlink as parent, not mounting" 
    270       continue 
    271     fi 
    272  
    273     # If this is already mounted we can skip for now 
    274     isDirMounted "${JDIR}/${1}${nullfs_mount}" && continue 
    275  
    276     echo "Mounting ${JDIR}/${1}${nullfs_mount}" 
    277     mount_nullfs ${nullfs_mount} ${JDIR}/${1}${nullfs_mount} 
    278   done 
    279    
    280 } 
    281  
    282 ### Mount all needed filesystems for the jail 
    283 mountjailxfs() { 
    284   
    285    # Mount the same mount-points as pbibox  
    286    mountpbibox "portjail" 
    287263 
    288264} 
     
    353329  touch ${JMETADIR}/jail-portjail 
    354330} 
    355  
    356 mkpbibox() { 
    357  
    358   if [ -z "${1}" ] ; then return ; fi 
    359  
    360   # KPM - Replace this section with a "mergeuserpw" function 
    361   # Need to be able to merge user accounts from /home on base system 
    362   # into the chroot each time we start it 
    363   ETCFILES="resolv.conf passwd master.passwd spwd.db pwd.db group localtime" 
    364   for file in ${ETCFILES}; do 
    365     rm ${1}/etc/${file} >/dev/null 2>&1 
    366     cp /etc/${file} ${1}/etc/${file} 
    367   done 
    368    
    369   # Need to symlink /home 
    370   chroot ${1} ln -fs /usr/home /home 
    371  
    372   # Make sure we remove our cleartmp rc.d script, causes issues 
    373   [ -e "${1}/etc/rc.d/cleartmp" ] && rm ${1}/etc/rc.d/cleartmp 
    374  
    375   # Flag this type 
    376   touch ${JMETADIR}/jail-pbibox 
    377  
    378 } 
    379  
    380331 
    381332mkpluginjail() { 
  • src-sh/warden/scripts/backend/importjail.sh

    r1620346 r8a1ef9e  
    2424  IP6="${JIP}" 
    2525  MASK6="${JMASK}" 
     26fi 
     27 
     28# Lets start importing the jail now 
     29###################################################################### 
     30 
     31 
     32chk=`echo "${IFILE}" | cut -c 1-1` 
     33if [ "$chk" != "/" ] 
     34then 
     35  IFILE="`pwd`/${IFILE}" 
     36fi 
     37 
     38 
     39# Extract the header info of the file 
     40cd ${WTMP} 
     41rm -rf tmp.$$ >/dev/null 
     42mkdir tmp.$$ 
     43cd tmp.$$ 
     44 
     45tar xvzf ${IFILE} >/dev/null 2>/dev/null 
     46if [ "${?}" != "0" ] 
     47then 
     48    echo "ERROR: Extracting header info failed! " 
     49    cd .. 
     50    rm -rf tmp.$$ 
     51    exit 5 
     52fi 
     53 
     54# Blank our variables and read in the header information 
     55VER="" 
     56OS="" 
     57FILES="" 
     58FIP4="" 
     59FIP6="" 
     60FHOST="" 
     61 
     62HEADER=`ls *.header` 
     63 
     64while read line 
     65do 
     66  #Check for the file version 
     67  echo "$line" | grep -q "Ver:" 
     68  if [ $? -eq 0 ]; then 
     69    VER="`echo $line | cut -d ' ' -f 2-10`" 
     70  fi 
     71 
     72  # Check for the OS Platform 
     73  echo "$line" | grep -q "OS:" 
     74  if [ $? -eq 0 ]; then 
     75    OS="`echo $line | cut -d ' ' -f 2-10`" 
     76  fi 
     77 
     78  # Check for the File Number  
     79  echo "$line" | grep -q "Files:" 
     80  if [ $? -eq 0 ]; then 
     81    FILES="`echo $line | cut -d ' ' -f 2-10`" 
     82  fi 
     83   
     84  # Check for the built in IP4 
     85  echo "$line" | grep -q "IP4:" 
     86  if [ $? -eq 0 ]; then 
     87    FIP4="`echo $line | cut -d ' ' -f 2-10`" 
     88  fi 
     89 
     90  # Check for the built in IP6 
     91  echo "$line" | grep -q "IP6:" 
     92  if [ $? -eq 0 ]; then 
     93    FIP6="`echo $line | cut -d ' ' -f 2-10`" 
     94  fi 
     95   
     96  # Check for the built in HOST 
     97  echo "$line" | grep -q "HOST:" 
     98  if [ $? -eq 0 ]; then 
     99    FHOST="`echo $line | cut -d ' ' -f 2-10`" 
     100  fi 
     101 
     102done < $HEADER  
     103 
     104 
     105if [ "$HOST" = "OFF" ] ; then 
     106   HOST="${FHOST}" 
    26107fi 
    27108 
     
    65146set_warden_metadir 
    66147 
    67 # Lets start importing the jail now 
    68 ###################################################################### 
    69  
    70  
    71 chk=`echo "${IFILE}" | cut -c 1-1` 
    72 if [ "$chk" != "/" ] 
    73 then 
    74   IFILE="`pwd`/${IFILE}" 
    75 fi 
    76  
    77  
    78 # Extract the header info of the file 
    79 cd ${WTMP} 
    80 rm -rf tmp.$$ >/dev/null 
    81 mkdir tmp.$$ 
    82 cd tmp.$$ 
    83  
    84 tar xvzf ${IFILE} >/dev/null 2>/dev/null 
    85 if [ "${?}" != "0" ] 
    86 then 
    87     echo "ERROR: Extracting header info failed! " 
    88     cd .. 
    89     rm -rf tmp.$$ 
    90     exit 5 
    91 fi 
    92  
    93 # Blank our variables and read in the header information 
    94 VER="" 
    95 OS="" 
    96 FILES="" 
    97 FIP4="" 
    98 FIP6="" 
    99 FHOST="" 
    100  
    101 HEADER=`ls *.header` 
    102  
    103 while read line 
    104 do 
    105   #Check for the file version 
    106   echo "$line" | grep -q "Ver:" 
    107   if [ $? -eq 0 ]; then 
    108     VER="`echo $line | cut -d ' ' -f 2-10`" 
    109   fi 
    110  
    111   # Check for the OS Platform 
    112   echo "$line" | grep -q "OS:" 
    113   if [ $? -eq 0 ]; then 
    114     OS="`echo $line | cut -d ' ' -f 2-10`" 
    115   fi 
    116  
    117   # Check for the File Number  
    118   echo "$line" | grep -q "Files:" 
    119   if [ $? -eq 0 ]; then 
    120     FILES="`echo $line | cut -d ' ' -f 2-10`" 
    121   fi 
    122    
    123   # Check for the built in IP4 
    124   echo "$line" | grep -q "IP4:" 
    125   if [ $? -eq 0 ]; then 
    126     FIP4="`echo $line | cut -d ' ' -f 2-10`" 
    127   fi 
    128  
    129   # Check for the built in IP6 
    130   echo "$line" | grep -q "IP6:" 
    131   if [ $? -eq 0 ]; then 
    132     FIP6="`echo $line | cut -d ' ' -f 2-10`" 
    133   fi 
    134    
    135   # Check for the built in HOST 
    136   echo "$line" | grep -q "HOST:" 
    137   if [ $? -eq 0 ]; then 
    138     FHOST="`echo $line | cut -d ' ' -f 2-10`" 
    139   fi 
    140  
    141 done < $HEADER  
    142148 
    143149cd .. 
     
    154160then 
    155161    echo "WARNING: This .wdn file was created on $OS, while this host is `uname -r | cut -d '-' -f 1`" 
    156     echo "This jail may not work...Importing anyway..." 
    157162fi 
    158163 
  • src-sh/warden/scripts/backend/listjails.sh

    rf4066f6 r2c39b15  
    3434  case "$1" in 
    3535    -v) VERBOSE="YES" ;;  
    36     -a) ALLJAILS="YES" ;;  
    3736     *) JAILS="${JAILS} .$1.meta" ;; 
    3837  esac 
     
    5554  AUTO="Disabled"  
    5655  STATUS="<unknown>" 
    57  
    58   # if not doing a full listing, skip pbi boxes 
    59   if [ "$ALLJAILS" != "YES" -a -e "${i}/jail-pbibox" ] ; then 
    60      continue 
    61   fi 
    6256 
    6357  if [ ! -e "${i}/id" ] ; then  
     
    146140  
    147141  # Figure out the type of jail 
    148   if [ -e "${i}/jail-pbibox" ] ; then 
    149     TYPE="pbibox" 
    150   elif [ -e "${i}/jail-portjail" ] ; then 
     142  if [ -e "${i}/jail-portjail" ] ; then 
    151143    TYPE="portjail" 
    152144  elif [ -e "${i}/jail-pluginjail" ] ; then 
  • src-sh/warden/scripts/backend/startjail.sh

    rf4066f6 r2c39b15  
    276276fi 
    277277 
    278 # If this is a pbibox, we don't really need to start any jail, just  
    279 # need to do some mounts and such 
    280 if [ -e "${JMETADIR}/jail-pbibox" ] ; then  
    281   mountpbibox ${JAILNAME} 
    282   exit 0 
    283 fi 
    284  
    285278# Make sure the jail is NOT already running 
    286279jls | grep ${JAILDIR}$ >/dev/null 2>/dev/null 
  • src-sh/warden/scripts/backend/stopjail.sh

    rf4066f6 r2c39b15  
    3434  echo "ERROR: No jail located at ${JAILDIR}" 
    3535  exit 5 
    36 fi 
    37  
    38 # If this a pbibox, we can just safely unmount its dirs and finish 
    39 if [ -e "${JMETADIR}/jail-pbibox" ] ; then  
    40   umountjailxfs ${JAILNAME}  
    41   exit 0 
    4236fi 
    4337 
Note: See TracChangeset for help on using the changeset viewer.