Changeset aa082fc8


Ignore:
Timestamp:
04/18/13 07:59:03 (17 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
781fd04
Parents:
891636a (diff), e50ac20 (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 github.com:pcbsd/pcbsd

Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • src-sh/pc-sysinstall/backend/functions-extractimage.sh

    r1620346 r89c5083  
    5555      fi 
    5656      echo_log "pc-sysinstall: Starting Extraction (${di})" 
    57       tar -xpv -C ${FSMNT} -f ${DDIR}/${di}.txz ${TAROPTS} >&1 2>&1 
     57      tar -xpv -C ${FSMNT} ${TAROPTS} -f ${DDIR}/${di}.txz 2>&1 | tee -a ${FSMNT}/.tar-extract.log 
    5858      if [ $? -ne 0 ]; then 
     59        cd / 
     60        echo "TAR failure occurred:" >>${LOGOUT} 
     61        cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT} 
    5962        exit_err "ERROR: Failed extracting the dist file: $di" 
    6063      fi 
  • src-sh/warden/bin/warden

    r1620346 re50ac20  
    3838Type in help <command> for information and usage about that command 
    3939 
    40   help - This help file" 
     40         help - This help file" 
    4141 
    4242if [ -e "${PROGDIR}/bin/warden-gui" ] ; then 
    43    echo "   gui - Launch the GUI menu" 
     43   echo "          gui - Launch the GUI menu" 
    4444fi 
    4545 
     
    5353       delete - Deletes a jail 
    5454       export - Exports a jail to a .wdn file 
     55        fstab - Start users \$EDITOR on jails custom fstab 
    5556          get - Gets options list for a jail 
    5657       import - Imports a jail from a .wdn file 
     
    465466}; 
    466467 
     468help_fstab() 
     469{ 
     470 title 
     471 echo "Help fstab 
     472 
     473Runs the users \$EDITOR on the jails custom fstab file. Can be used to setup 
     474nullfs mounts and others for a specific jail 
     475 
     476Usage: 
     477 
     478  warden fstab [hosts] 
     479" 
     480}; 
     481 
    467482help_import() 
    468483{ 
     
    615630           list) help_list ;; 
    616631           export) help_export ;; 
     632           fstab) help_fstab ;; 
    617633           import) help_import ;; 
    618634           pkgs) help_pkgs ;; 
     
    653669 
    654670         ${PROGDIR}/scripts/backend/listpbis.sh "${JAILNAME}"  
     671         ;; 
     672    fstab) JAILNAME="${2}" 
     673         if [ -z "${JAILNAME}" ]; then exit_err "No jail specified!"; fi 
     674         if [ ! -e "${JDIR}/${JAILNAME}" ]; then exit_err "No such jail!"; fi 
     675         set_warden_metadir 
     676         if [ ! -e "${JMETADIR}/fstab" ] ; then 
     677            echo "# Device      Mountpoint      FStype          Options Dump Pass" > ${JMETADIR}/fstab 
     678         fi 
     679         if [ -z "$EDITOR" ]; then EDITOR="vi"; fi 
     680         $EDITOR ${JMETADIR}/fstab 
     681         exit $? 
    655682         ;; 
    656683    get) require_root 
  • src-sh/warden/scripts/backend/startjail.sh

    r1620346 re50ac20  
    140140 
    141141  if [ -e "${JMETADIR}/jail-portjail" ] ; then mountjailxfs ${JAILNAME} ; fi 
     142fi 
     143 
     144# Check for user-supplied mounts 
     145if [ -e "${JMETADIR}/fstab" ] ; then 
     146   echo "Mounting user-supplied file-systems" 
     147   mount -a -F ${JMETADIR}/fstab 
    142148fi 
    143149 
  • src-sh/warden/scripts/backend/stopjail.sh

    r1620346 re50ac20  
    5555 
    5656if [ -e "${JMETADIR}/jail-linux" ] ; then LINUXJAIL="YES" ; fi 
     57 
     58# Check for user-supplied mounts 
     59if [ -e "${JMETADIR}/fstab" ] ; then 
     60   echo "Unmounting user-supplied file-systems" 
     61   umount -a -F ${JMETADIR}/fstab 
     62fi 
    5763 
    5864if [ "$LINUXJAIL" = "YES" ] ; then 
  • src-sh/warden/scripts/rc.d/shutdown.sh

    r1620346 r29c3581  
    2626for i in `ls -d .*.meta 2>/dev/null` 
    2727do 
    28   if [ ! -e "${i}/ip" ] ; then continue; fi 
    29   jIP="`cat ${i}/ip`" 
     28  JAILNAME=`echo ${i}|sed 's|.meta$||'|sed 's|^.||'` 
    3029 
    31   ${PROGDIR}/scripts/backend/checkstatus.sh "${jIP}" 2>/dev/null 
     30  ${PROGDIR}/scripts/backend/checkstatus.sh "${JAILNAME}" 2>/dev/null 
    3231  if [ "$?" = "0" ] ; then 
    33     echo "Stopping jail (${jIP})" 
    34     warden stop "${jIP}" "FAST" 
     32    echo "Stopping jail (${JAILNAME})" 
     33    warden stop "${JAILNAME}" "FAST" 
    3534  fi 
    3635done 
  • src-sh/warden/scripts/rc.d/startup.sh

    r1620346 r29c3581  
    2626for i in `ls -d .*.meta 2>/dev/null` 
    2727do 
    28   if [ -e "${i}/ip" -a -e "${i}/autostart" ] ; then 
    29    jIP=`cat ${i}/ip` 
    30    echo -e "Starting Jail (${jIP})...\c" 
    31    warden start "${jIP}" >/dev/null 2>/dev/null 
     28  if [ -e "${i}/id" -a -e "${i}/autostart" ] ; then 
     29   JAILNAME=`echo ${i}|sed 's|.meta$||'|sed 's|^.||'` 
     30   echo -e "Starting Jail (${JAILNAME})...\c" 
     31   warden start "${JAILNAME}" >/dev/null 2>/dev/null 
    3232   echo "Done" 
    3333  fi 
  • src-qt4/pc-mounttray/fsDialog.cpp

    rbe298e4 r891636a  
    22 
    33FSDialog::FSDialog() : QDialog(){ 
     4  this->setWindowTitle( tr("System Disk Capacity") ); 
     5  this->setWindowIcon( QIcon(":icons/harddrive.png")); 
    46  generateUI(); 
    57} 
     
    5961  QHBoxLayout *hb = new QHBoxLayout(); 
    6062  hb->addStretch(); 
    61   QPushButton *closeButton = new QPushButton("Close"); 
     63  QPushButton *closeButton = new QPushButton(QIcon(":icons/application-exit.png"),tr("Close")); 
    6264  hb->addWidget(closeButton); 
    6365  hb->addStretch(); 
     
    6769  this->setLayout(vlayout); 
    6870  //Now resize the dialog to fit the widget appropriately 
    69   this->adjustSize(); 
     71  this->adjustSize(); //still not working right -- need research on this 
    7072} 
    7173 
  • src-qt4/pc-mounttray/fsDialog.h

    rbe298e4 r891636a  
    1212#include <QBrush> 
    1313#include <QColor> 
     14#include <QIcon> 
    1415 
    1516#include "fsWatcher.h" 
  • src-qt4/pc-mounttray/fsWatcher.cpp

    rbb6089a r891636a  
    44  //setup the timer 
    55  timer = new QTimer(); 
     6  timer->setSingleShot(TRUE); 
    67  QObject::connect(timer, SIGNAL(timeout()), this, SLOT(checkFS())); 
    78} 
     
    1112 
    1213void FSWatcher::start(int ms){  
    13     timer->start(ms);  
     14    timer->stop(); 
     15    timer->setInterval(ms); //max time between system checks 
     16    timer->start();  
    1417    QTimer::singleShot(2000,this,SLOT(checkFS()) ); //make sure to perform a check when it starts up 
    1518} 
     
    100103} 
    101104 
    102 //====== Private Slot ======= 
     105//====== Public Slot ======= 
    103106void FSWatcher::checkFS(){ 
    104107  QStringList devList = getFSmountpoints(); 
     
    117120    emit FSWarning(title,message); 
    118121  } 
     122  timer->start(); //reset the timer again 
    119123} 
    120124 
     125//===== Calculate Percentages ===== 
    121126int FSWatcher::calculatePercentage(int used, int total){ 
    122127  double U = used; 
  • src-qt4/pc-mounttray/fsWatcher.h

    rbb6089a r891636a  
    1010#include <QCoreApplication> 
    1111#include <QDebug> 
     12 
    1213 
    1314class FSWatcher : public QObject 
     
    3132  static int calculatePercentage(int,int); 
    3233   
    33 private slots: 
     34public slots: 
    3435  void checkFS(); //function in a timer loop 
    3536 
  • src-qt4/pc-mounttray/mountTray.cpp

    rbb6089a r891636a  
    2121  getInitialUsername(); //try to detect the non-root user who is running the program with root permissions 
    2222  getDefaultFileManager(); //try to detect the default file-manager for opening the mount directory 
     23  loadSavedSettings(); 
    2324   
    2425  trayIcon = new QSystemTrayIcon(this); 
    2526  trayIconMenu = new QMenu(); 
    26          
     27  //Generate the system menu options (these don't change) 
     28  sysMenu = new QMenu( tr("More Options") ); 
     29    sysMenu->setIcon( QIcon(":icons/config.png") ); 
     30    //Add the additional options 
     31    sysMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) ); 
     32    sysMenu->addAction( QIcon(":icons/harddrive.png"), tr("View Disk Usage"),this,SLOT(slotOpenFSDialog()) ); 
     33    sysMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) ); 
     34    //Add the setting dialog option seperately 
     35    sysMenu->addSeparator(); 
     36    sysMenu->addAction( QIcon(":icons/config.png"), tr("Change Settings"), this, SLOT(slotOpenSettings()) ); 
     37    //Add the Close button seperately 
     38    sysMenu->addSeparator(); 
     39    sysMenu->addAction( QIcon(":icons/application-exit.png"), tr("Close Tray"), this, SLOT(closeTray()) ); 
     40   
    2741  // Tie the left-click signal to open the context menu 
    2842  connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) ); 
     
    4458   
    4559  //Start up the filesystem watcher 
    46   qDebug() << "-Starting up the disk space alert system"; 
    4760  diskWatcher = new FSWatcher(); 
    4861  connect(diskWatcher,SIGNAL(FSWarning(QString,QString)),this,SLOT(slotDisplayWarning(QString,QString))); 
    49   diskWatcher->start(3600000); // check every 1 hour in milliseconds 
     62  if(useDiskWatcher){  
     63    qDebug() << "-Starting up the disk space alert system"; 
     64    diskWatcher->start(diskTimerMaxMS);  
     65  } 
    5066   
    5167  //Update the tray menu and icons 
     
    7692  //Separate the extra options at the end 
    7793  trayIconMenu->addSeparator(); 
    78   //Add the "open media" entry to the list 
    79   trayIconMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) ); 
    80   trayIconMenu->addSeparator(); 
    81   trayIconMenu->addAction( QIcon(":icons/folder.png"), tr("Current Disk Usage"),this,SLOT(slotOpenFSDialog()) ); 
    82   trayIconMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) ); 
    83   //Add the "close tray" entry to the list 
    84   trayIconMenu->addAction( QIcon(":icons/application-exit.png"), tr("Close Tray"), this, SLOT(closeTray()) ); 
    85    
     94  trayIconMenu->addMenu(sysMenu); 
    8695  //Apply the menu to the Tray 
    8796  trayIcon->setContextMenu(trayIconMenu); 
     
    167176 
    168177void MountTray::newDevdMessage(){        
    169   devdTimer->start(1000); //wait 1.5 seconds before checking for device changes 
     178  devdTimer->start(1500); //wait 1.5 seconds before checking for device changes 
    170179  return; 
    171180} 
     
    245254    } 
    246255  } //end loop over cd/dvd devices 
     256   
     257  //Run the disk space check if appropriate 
     258  if(useDiskWatcher && useDiskTimerDevd && showPopup){ diskWatcher->checkFS(); } 
    247259} 
    248260 
     
    334346    deviceList[i]->updateItem(); 
    335347  } 
     348  //Run the disk check if appropriate 
     349  if(useDiskWatcher){ diskWatcher->checkFS(); } 
    336350} 
    337351 
    338352void MountTray::slotOpenFSDialog(){ 
    339   //Open up the Filsystem disk space monitoring dialog 
     353  //Open up the Filesystem disk space monitoring dialog 
    340354  diskDisplay = new FSDialog(); 
    341355  diskDisplay->show(); 
     356} 
     357 
     358void MountTray::slotOpenSettings(){ 
     359  //Stop the refresh timer on the watcher 
     360  diskWatcher->stop(); 
     361  //Open up the settings window and apply changes as necessary 
     362  SettingsDialog *sdlg = new SettingsDialog(); 
     363  sdlg->useDiskWatcher = useDiskWatcher; 
     364  sdlg->useDiskAutoTimer = useDiskTimerDevd; 
     365  sdlg->diskRefreshMS = diskTimerMaxMS; 
     366  sdlg->showDialog(); 
     367  //Now parse the output and save if necessary 
     368  if(sdlg->SettingsChanged){ 
     369    useDiskWatcher = sdlg->useDiskWatcher; 
     370    useDiskTimerDevd = sdlg->useDiskAutoTimer; 
     371    diskTimerMaxMS = sdlg->diskRefreshMS; 
     372    qDebug() << "INFO: Saving updated settings to file"; 
     373    saveCurrentSettings(); //update the saved settings 
     374  } 
     375  //Now restart the disk watcher if enabled 
     376  if(useDiskWatcher){ diskWatcher->start(diskTimerMaxMS); } 
    342377} 
    343378 
     
    362397  trayIcon->showMessage(title, msg , QSystemTrayIcon::Warning,5000 ); 
    363398} 
     399 
     400void MountTray::loadSavedSettings(){ 
     401  //The saved settings file 
     402  QString filename = QDir::homePath()+"/.mounttray.settings"; 
     403  //Set the defaults 
     404  useDiskWatcher=TRUE; useDiskTimerDevd=TRUE; 
     405  diskTimerMaxMS=3600000; //1 hour refresh timer 
     406  //Now load the file 
     407  QFile file(filename); 
     408  if(file.exists()){ 
     409    if(!file.open(QIODevice::ReadOnly | QIODevice::Text)){  
     410      qDebug() << "-Could not open settings file: using defaults"; 
     411      return;  
     412    } 
     413    QTextStream in(&file); 
     414    while(!in.atEnd()){ 
     415      QString line = in.readLine(); 
     416      if(!line.startsWith("#")){ //skip comment lines 
     417        QString var = line.section(")",0,0,QString::SectionSkipEmpty).simplified(); 
     418        QString val = line.section(")",1,30,QString::SectionSkipEmpty).simplified(); 
     419        if(var=="UseDiskSpaceMonitoring"){  
     420          if(val.toLower() == "true"){ useDiskWatcher = TRUE;} 
     421          else{ useDiskWatcher = FALSE; } 
     422        }else if(var=="UseDiskSpaceDevdTiming"){ 
     423          if(val.toLower() == "true"){ useDiskTimerDevd = TRUE;} 
     424          else{ useDiskTimerDevd = FALSE; }      
     425        }else if(var=="DiskSpaceTimingMaxMilliseconds"){ 
     426          diskTimerMaxMS = val.toInt();  
     427        } 
     428      } 
     429    } 
     430    file.close(); 
     431  }else{ 
     432    qDebug() << "-Creating new settings file with defaults"; 
     433    saveCurrentSettings(); 
     434  } 
     435} 
     436 
     437void MountTray::saveCurrentSettings(){ 
     438  //The saved settings file 
     439  QString filename = QDir::homePath()+"/.mounttray.settings"; 
     440  //Now write the current values to the file 
     441  QFile file(filename); 
     442  if(!file.open(QIODevice::WriteOnly | QIODevice::Text)){ 
     443    qDebug() << "ERROR: Could not open file to save settings:"<<filename; 
     444    return; 
     445  } 
     446  QTextStream out(&file); 
     447  out << "#pc-mounttray saved settings file\n"; 
     448  out << "# DO NOT EDIT: Use the settings dialog in the application instead!!\n"; 
     449  //Save the settings 
     450  out << "UseDiskSpaceMonitoring)"; 
     451  if(useDiskWatcher){ out << "true\n";} 
     452  else{ out << "false\n"; } 
     453  out << "UseDiskSpaceDevdTiming)"; 
     454  if(useDiskTimerDevd){ out << "true\n";} 
     455  else{ out << "false\n"; } 
     456  out << "DiskSpaceTimingMaxMilliseconds)"+QString::number(diskTimerMaxMS)+"\n"; 
     457  //Now close the file 
     458  file.close(); 
     459} 
  • src-qt4/pc-mounttray/mountTray.h

    rbb6089a r891636a  
    1111#include <QList> 
    1212#include <QTimer> 
     13#include <QDir> 
     14#include <QFile> 
     15#include <QTextStream> 
    1316 
    1417#include "menuItem.h" 
     
    1619#include "fsWatcher.h" 
    1720#include "fsDialog.h" 
     21#include "settingsDialog.h" 
    1822 
    1923extern bool DEBUG_MODE; 
     
    4852  void slotRescan(); 
    4953  void slotOpenFSDialog(); 
     54  void slotOpenSettings(); 
    5055   
    5156private: 
     
    5661  int numMount, numAvail; 
    5762  QSystemTrayIcon* trayIcon; 
    58   QMenu* trayIconMenu; 
     63  QMenu *trayIconMenu, *sysMenu; 
    5964  QList<MenuItem*> deviceList; 
    6065  QStringList oldsysdev; 
    6166  FSWatcher *diskWatcher; 
    6267  FSDialog *diskDisplay; 
     68  //Saved Settings 
     69  bool useDiskWatcher, useDiskTimerDevd; 
     70  int diskTimerMaxMS; //milliseconds 
    6371 
    6472 
     
    7078  void getInitialUsername(); 
    7179  void getDefaultFileManager(); 
     80  void loadSavedSettings(); 
     81  void saveCurrentSettings(); 
    7282   
    7383}; 
  • src-qt4/pc-mounttray/pc-mounttray.pro

    rbb6089a r891636a  
    1111        devCheck.h \ 
    1212        fsWatcher.h \ 
    13         fsDialog.h 
     13        fsDialog.h \ 
     14        settingsDialog.h 
    1415 
    1516SOURCES += main.cpp \ 
     
    1819        devCheck.cpp \ 
    1920        fsWatcher.cpp \ 
    20         fsDialog.cpp 
     21        fsDialog.cpp \ 
     22        settingsDialog.cpp 
    2123 
    2224RESOURCES += pc-mounttray.qrc 
  • src-qt4/pc-mounttray/pc-mounttray.qrc

    r1620346 r891636a  
    1313    <file>icons/harddrive.png</file> 
    1414    <file>icons/refresh.png</file> 
     15    <file>icons/config.png</file> 
     16    <file>icons/checkmark.png</file> 
    1517  </qresource> 
    1618</RCC> 
Note: See TracChangeset for help on using the changeset viewer.